简体   繁体   中英

Not a valid parameter definition for Swagger query?

# 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 is giving me not a valid parameter definition for this query parameter. If I remove all references to Username in the path and parameter definition, no issues.

According to the Swagger Specification , I believe I'm using query parameters right, but somehow it's not.

Realized the issue was in path. The path does not need to include the query parameter.

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

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

It only needs the query to be defined in parameters. Otherwise bugs the whole thing out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM