【问题标题】:Not a valid parameter definition for Swagger query?不是 Swagger 查询的有效参数定义?
【发布时间】:2016-10-04 19:26:53
【问题描述】:
# GET verb version of the "GetClientsForGadget" method from the original ASMX Service
  /clients/ProspectClient/roleandcstbased/{OrgNmFilter}/{SortNm}?{UserName}:
    get: 
      tags:
        - Client
      summary: Merging of GetClientsforGadget and GetClientsForUser
      operationId: ClientsForGadgetGET
      parameters:
        - name: OrgNmFilter
          in: path
          description: Organization Name Filter
          required: true
          type: string
        - name: SortNm
          in: path
          description: Sort Field
          required: true
          type: string
        - name: UserName
          in: query
          description: User's Identity
          required: false
          type: string
      responses:
        200: 
          description: Output results for GetClientsForGadget endpoint
          schema: 
            $ref: '#/definitions/ClientOutput'

Swagger 给我这个查询参数的无效参数定义。如果我删除路径和参数定义中对用户名的所有引用,则没有问题。

根据Swagger Specification,我相信我使用的查询参数是正确的,但不知何故不是。

【问题讨论】:

标签: swagger


【解决方案1】:

意识到问题正在解决。路径不需要包含查询参数。

/clients/ProspectClient/roleandcstbased/{OrgNmFilter}/{SortNm}?{UserName}:

/clients/ProspectClient/roleandcstbased/{OrgNmFilter}/{SortNm}:

只需要在参数中定义查询。否则整个事情都会出错。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-02
    • 2017-08-30
    • 2015-11-22
    • 1970-01-01
    • 1970-01-01
    • 2014-02-03
    • 2023-03-09
    • 2019-02-18
    相关资源
    最近更新 更多