cancel
Showing results for 
Search instead for 
Did you mean: 

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

gustavozor
Visitor

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 😞

 

New Here?
Join us and watch the welcome video: