如何正确定义swagger中的可重用链接



我正在使用Open API 3.0.0 的型锻

以下是我对Api的定义:

paths:
/offerers:
get:
summary: give all offerers back
operationId: allOfferers
description: give you all offerers back
responses:
'200':
description: oferers results
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OfferersId'
links:
GetSingleOffererById:
$ref: '#/components/links/GetSingleOffererById'
'400':
description: something went terribly wrong
/offerers/{offererId}:
parameters:
- in: path
name: offererId
schema:
$ref: '#/components/schemas/OfferersId'
required: true
get: 
parameters:
- $ref: '#/components/schemas/OfferersId'
summary: give one specified offerer back
operationId: singleOfferer
description: give one offerer back. Specified by its id
responses:
'200':
description: offerers results
content:
application/json:
schema:
$ref: '#/components/schemas/Offerers'
'400':
description: something went terribly wrong
components:
schemas:
OfferersId:
type: number
example: 123
Offerers:
type: object
required:
- offererId
- name
properties:
id:
$ref: '#/components/schemas/OfferersId'
name: 
type: string
example: "Mark Mustermann"
location:
type: string
example: "90449 Nürnberg"
experience:
type: string
example: "8 Jahre"
openingHours:
type: string
example: "Werktags: 10:15-18:30/tWochenende: geschlossen."
links:
GetSingleOffererById:
operationId: singleOfferer
description: the offererId in the response will be used as offererId in the request
paramters:
offererId: $reponse.body#/OfferersId

此定义的大部分内容都是无错误的。但最后一节的组件/链接在"operationId:singleOffer"一行给了我一个错误:

不应具有其他属性additionalProperty:operationId,参数

所以我的问题是:我必须如何更正我的定义,以使可重用链接有效?

Swagger编辑器中的"不应具有其他属性"错误通常意味着以下错误之一:

  1. 关键字拼写错误
  2. 语法/结构不正确

在您的示例中,它是(1(-paraMTers应该是paraMETers

最新更新