Ответ 1
В принципе, вы объявляете путь с параметром пути в нем, используя шаблоны путей. В этом случае {id}
объявляет параметр пути с именем id
.
Когда вы объявляете такой путь, это означает, что вы должны объявить этот параметр пути как часть операции.
Взгляните на этот пример YAML:
/pets/{id}:
get:
description: Returns a user based on a single ID, if the user does not have access to the pet
operationId: findPetById
produces:
- application/json
- application/xml
- text/xml
- text/html
parameters:
- name: id
in: path
description: ID of pet to fetch
required: true
type: integer
format: int64
responses:
'200':
description: pet response
schema:
$ref: '#/definitions/pet'
default:
description: unexpected error
schema:
$ref: '#/definitions/errorModel'
Вы можете увидеть там {id}
в пути и соответствующее определение параметра id
. Без него спецификация не будет действительна.