如何在OpenAPI 3.0.3中隐藏一个字段
我创建了一个包含一个get和apt的摇摇欲坠,第一个在我称之为元素(“ mycar”)的情况下,第二个我更新了车牌。作为一个相同的对象,我如何确保在招摇中只能显示板而不是对象的所有字段?
'/example/car/{carId}':
get:
summary: Get a Car by Id
description: Get a car
operationId: getCar
tags:
- Car
parameters:
- in: path
name: carId
required: true
description: carID
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/MyCar'
[...]
put:
summary: Update car plate
description: update a plate by carID
operationId: updatePlate
tags:
- Car
parameters:
- in: path
name: carId
required: true
description: CarID to save
schema:
type: string
requestBody:
description: The new plate to create
content:
application/json:
schema:
$ref: '#/components/schemas/MyCar'
[...]
MyCar:
type: object
properties:
id:
type: string
owner:
type: string
plate:
type: string
有没有办法仅显示前牌中的车牌而没有显示整个对象?
I created a swagger containing a get and a put, where in the first I call an element ("MyCar") and in the second I update the license plate. Being the same object, how can I make sure that in the swagger put it can show only the plate instead of all the fields of the object?
'/example/car/{carId}':
get:
summary: Get a Car by Id
description: Get a car
operationId: getCar
tags:
- Car
parameters:
- in: path
name: carId
required: true
description: carID
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/MyCar'
[...]
put:
summary: Update car plate
description: update a plate by carID
operationId: updatePlate
tags:
- Car
parameters:
- in: path
name: carId
required: true
description: CarID to save
schema:
type: string
requestBody:
description: The new plate to create
content:
application/json:
schema:
$ref: '#/components/schemas/MyCar'
[...]
MyCar:
type: object
properties:
id:
type: string
owner:
type: string
plate:
type: string
is there a way to show only the license plate in the put without showing the whole object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论