不是Swagger查询的有效参数定义?

时间:2016-10-04 19:26:53

标签: swagger

# 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没有给我这个查询参数的有效参数定义。如果我删除路径和参数定义中对Username的所有引用,则没有问题。

根据Swagger Specification,我相信我正确地使用了查询参数,但不知怎的,它不是。

1 个答案:

答案 0 :(得分:1)

意识到问题在于道路。该路径不需要包含查询参数。

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

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

只需要在参数中定义查询。否则就会把整个事情搞得一团糟。