我应该在OpenAPI的路径参数中传递所有可能的选项吗

时间:2019-08-01 10:45:35

标签: swagger openapi

我有以下情况:

  

请求示例:

     

www.example.org/test/ {username}?attributes = attributeList

attributeList是包含不同属性(例如user_age,user_city等)的巨大列表。

我应该只传递数组参数属性,还是必须提供理论上可以包含的所有可能的属性?

以这种方式传递属性可以吗?

paths:
 /test/{username}
 options:
  parameters:
    - name: username
      in: path
      required: true
      schema:
        type: string
    - name: attributes
      in: query
      required: true
      schema:
        $ref: '#/components/schemas/attributeList'

components:
  schemas:
    attributeList:
      description: 'List of attributes'
      type: array
      items:
        type: string

非常感谢您!

0 个答案:

没有答案