Forum Discussion

inauro's avatar
inauro
Occasional Contributor
4 years ago

Some Schemas in External Url in $ref do not resolve and shown as blank in the Response Schema

Hi, 

 

While documenting my API responses, I use $ref to point to a response format stored externally. Few of the formats like the one mentioned below do not resolve appropriately and are shown as blank in the Response Documentation section for that API. 

 

The documentation is as follows:

responses:
'200':
description: Success
content:
application/json:
schema:
$ref: 'https://perspiomodels.blob.core.windows.net/devicemodels/DeviceInfo.json'

 

The documentation corresponding to this is as shown (Empty):

Can you check and get back as soon as possible?

 

Thanks!

 


 

3 Replies

    • HKosova's avatar
      HKosova
      SmartBear Alumni (Retired)

      Hi inauro,

      The schema keyword expects a schema definition, but the linked file is not a schema. Here's how you can define a schema for your response:

       

            responses:
              '200':
                description: Success
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/DeviceInfo'  # <------
      
      components:
        schemas:
          DeviceInfo:     # <------
            type: object
            properties:
              tenantId:
                type: string
                example: gf-d30caee4-5217-4731-9183-f1f2242f03ae
              assetInfo:
                type: object
                properties:
                  ...
              deviceInfo:
                type: object
                properties:
                  ...

       

      • inauro's avatar
        inauro
        Occasional Contributor

        I tried with Open API Schema as well but same result. Schema not showing in the response. Can you check and let me know what needs to be corrected?

         

        responses:
                '200':
                  descriptionSuccess
                  content:
                    application/json:
                      schema:
         
        Asset Open API Schema Snippet 

         

         

        Thanks!