Object 我可以向YAML Swagger对象添加版本吗?
我正在创建一个API定义,我想将我的规范模型拆分为不同的文档,并使用JSON指针“$ref”重用它们。 我需要找到一种在YAML文件中添加版本的方法。 例如:Object 我可以向YAML Swagger对象添加版本吗?,object,properties,swagger,versioning,Object,Properties,Swagger,Versioning,我正在创建一个API定义,我想将我的规范模型拆分为不同的文档,并使用JSON指针“$ref”重用它们。 我需要找到一种在YAML文件中添加版本的方法。 例如: ***pj.yaml*** pJType: verison: 1.0 type: object properties: cnpj: type: integer ***afastamento.yaml*** oswagger: '2.0' info: version: '1.0' title: A
***pj.yaml***
pJType:
verison: 1.0
type: object
properties:
cnpj:
type: integer
***afastamento.yaml***
oswagger: '2.0'
info:
version: '1.0'
title: AfastamentoService
consumes:
- application/json
produces:
- application/json
paths:
'/{nis}':
get:
parameters:
- in: path
name: nis
type: integer
required: true
responses:
'200':
description: OK
schema:
$ref: '#/definitions/pesquisarResponse'
definitions:
pesquisarResponse:
type: object
properties:
listaAfastamento:
$ref: '#/definitions/listaAfastamentoType'
...
empregadorType:
type: object
properties:
personalidadeJuridica:
type: string
pessoaJuridica:
$ref: pJ.yaml#/pessoaJuridicaType
...
您可以使用扩展属性(前缀为
x-
)向规范中添加任意数据:
#pj.yaml
pJType:
x版本:1.0
类型:对象
特性:
cnpj:
类型:整数