OpenAPI 3.2.0 - 路径模板表达式与参数对象不匹配

作者: galvo创建于 2026年4月16日更新于 2026年8月6日

/ pet/{petId}: get: tags:

  • pet summary: Find pet by identifier. description: Returns a single pet. operationId: getPetById parameters:
  • $ref: '#/components/parameters/petId' responses: 200: description: successful operation content: application/json: schema: $ref: '#/components/schemas/Pet' application/xml: schema: $ref: '#/components/schemas/Pet' 400: description: Invalid ID supplied 404: description: Pet not found default: description: Unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" security:
  • api_key: []
  • petstore_auth:
  • write:pets
  • read:pets components: parameters: petId: name: petId in: path description: ID of the pet required: true schema: type: string schemas: Category: type: object properties: id: type: integer format: int64 examples: [1] name: type: string examples: [Dogs] xml: name: category Tag: type: object properties: id: type: integer format: int64 name: type: string xml: name: tag Pet: required:
  • name
  • photoUrls type: object properties: id: type: integer format: int64 examples: [10] name: …

内容来源: swagger-api/swagger-editor