我有以下架构定义:
swagger: '2.0'
...
definitions:
Service:
type: object
properties:
serviceId:
type: string
description: Device or service identification number
example: 1111111111
location:
type: string
description: Location of the service
example: '400 Street name, City State postcode, Country'
我想将location
字段注释为已弃用。有没有办法做到这一点?
答案 0 :(得分:9)
在OpenAPI 3.0中添加了将架构和架构属性标记为deprecated
的可能性:
openapi: 3.0.1
...
components:
schemas:
Service:
type: object
properties:
location:
type: string
description: Location of the service
example: '400 Street name, City State postcode, Country'
deprecated: true # <---------
如果您使用OpenAPI 2.0(Swagger 2.0),您唯一能做的就是在属性description
中口头记录弃用。
答案 1 :(得分:0)
根据documentation,使用deprecated
属性就足够了
/pet/findByTags:
get:
deprecated: true