Forum Discussion

ChrisLaurie's avatar
4 years ago

Empty object in response in Swagger ui

I get see this in the response in the ui: I was expecting the layout of RETURN inside the object and not just a pair of curly braces. My swagger YAML is:   openapi: '3.0.1' info: title: S...
  • HKosova's avatar
    4 years ago

    Hi Chris,

     

    Change the schemas as follows:

    components:
      schemas:
        ...
        ResponseBody:
          type: object
          description: 'The JSON returned by the api.'
          properties:
            RETURN:
              $ref: '#/components/schemas/RETURN'   # <------------
            ADDRESSDATA:
              type: array
              items:
                $ref: '#/components/schemas/ADDRESSDATA'
        RETURN:
          description: 'Test return'
          type: object      # <------------
          properties:
            ...