Forum Discussion

gustavozor's avatar
gustavozor
Visitor
3 years ago

How do I return an array of objects with 3 differents objects?

I need to get a response like this

 

[

   {

      "objProp1": First object inside the response body

    },

   {

      "objProp2": Second object inside the response body

    },

   {

      "objProp3": Third object inside the response body

    }

]

 

And I'm setting up the yaml file like this:

 

Request/Response:

  type: array

  items:

    Object1:

       type: object

       properties:

         objProp1: string

    Object2:

       type: object

       properties:

         objProp2: string

    Object3:

       type: object

       properties:

         objProp3: string

 

But when I open the swagger.. both request body and response body are showing this:

 

[

  "string"

]

 

what am I doing wrong? please help 😞

 

No RepliesBe the first to reply