下面的OpenAPI定义将生成的URL为http://localhost:9200/GetCourse?id=1。如何更改定义以将URL生成为http://localhost:9200/GetCourse/1?
/GetCourse:
get:
summary: Get Courses
description: >
The GetCourse details.
tags:
- Content information
parameters:
- name: id
in: query
description: The ID of the HEI being queried
required: true
type: integer
responses:
'200':
description: An array of courses
schema:
$ref: '#/definitions/Courses'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
答案 0 :(得分:1)
in
)从query
更改为path
。/{id}
。paths:
/GetCourse/{id}: # <----
get:
...
parameters:
- name: id
in: path # <----
description: The ID of the HEI being queried
required: true
type: integer