Define a response object with an array in YAML using the Swagger editor

I am working on defining an API in a Swagger editor using YAML. I am trying to present the following response organ:

{ success: true, ids: [123456, ...] } 

and this is what my YAML looks like:

 definitions: SuccessfulResponse: type: object properties: success: type: boolean description: True if the all operations were successful ids: type: array items: id: type: string 

Ive tried a few different ways, but kinda like, but nothing seems valid

enter image description here

How to correctly describe the return object specified above ive?

+5
source share
1 answer

Here is an example to define a property as an array of strings:

  photoUrls: type: array items: type: string 

Link: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml#L670-L676

+12
source

Source: https://habr.com/ru/post/1259388/


All Articles