How can I define a property type as being a list (list, set, array, collection) of string in my YAML Swagger definition

前端 未结 2 1484
我在风中等你
我在风中等你 2021-01-17 18:06

I am writing a swagger definition file for an API. The API is a for a GET request

/path/to/my/api:
  get:
    summary: My Custom API
    description: |
              


        
2条回答
  •  星月不相逢
    2021-01-17 18:33

    For a list of strings, you can describe as follows:

          type: array
          items:
            type: string
    

    Ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject

    Example:

    • https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml#L93-L100 (OpenAPI v2)
    • https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml#L71-L78 (OpenAPI v3)

提交回复
热议问题