Yaml 消除虚张声势冗余
我已经编写了一个swagger.yaml文件来定义类型。 我下面的招摇过市是工作,但有冗余。为了消除这一点,我尝试了schema和$ref,但似乎没有任何效果 我的工作炫耀文件:Yaml 消除虚张声势冗余,yaml,swagger,Yaml,Swagger,我已经编写了一个swagger.yaml文件来定义类型。 我下面的招摇过市是工作,但有冗余。为了消除这一点,我尝试了schema和$ref,但似乎没有任何效果 我的工作炫耀文件: definitions: RecallPerformanceDetailsResponse: type: object additionalProperties: false required: - parts_not_avail_vin_confirmed - pa
definitions:
RecallPerformanceDetailsResponse:
type: object
additionalProperties: false
required:
- parts_not_avail_vin_confirmed
- parts_not_avail_disconnect
- difficulty_obtaining_remedy
- dealer_sell_through
properties:
parts_not_avail_vin_confirmed:
type: object
additionalProperties: false
required:
- no_mfr_disposition
- remedied
- remedy_in_progress
- no_action
- total
- with_mfr_notes
- other
properties:
no_mfr_disposition:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
remedied:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
remedy_in_progress:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
no_action:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
total:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
with_mfr_notes:
type: object
additionalProperties: false
required:
- percent
- count
properties:
percent:
type: string
count:
type: string
other:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
parts_not_avail_disconnect:
type: object
additionalProperties: false
required:
- no_mfr_disposition
- remedied
- remedy_in_progress
- no_action
- total
- with_mfr_notes
- other
properties:
no_mfr_disposition:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
remedied:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
remedy_in_progress:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
no_action:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
total:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
with_mfr_notes:
type: object
additionalProperties: false
required:
- percent
- count
properties:
percent:
type: string
count:
type: string
other:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: string
我正在尝试的:(获取模式不匹配错误,它无法识别$ref,我想,不确定原因)
RecallPerformanceResponseObject
中存在缩进错误-属性名称必须缩进到属性的右侧(可能是复制粘贴错误?),但除此之外,您的定义是正确的。您如何使用该定义以及什么工具会出现这些“架构不匹配”错误?在RecallPerformanceResponseObject
中存在缩进错误-属性名称必须缩进到属性的右侧(可能是复制粘贴错误?),但除此之外,您的定义是正确的。您如何使用该定义,以及什么工具会给您这些“模式不匹配”错误?
definitions:
RecallPerformanceDetailsResponse:
type: object
required:
- parts_not_avail_vin_confirmed
- parts_not_avail_disconnect
properties:
parts_not_avail_vin_confirmed:
$ref: "#/definitions/RecallPerformanceResponseObject"
parts_not_avail_disconnect:
$ref: "#/definitions/RecallPerformanceResponseObject"
RecallPerformanceResponseObject:
type: object
required:
- no_mfr_disposition
- remedied
- remedy_in_progress
- no_action
- total
- with_mfr_notes
properties:
no_mfr_disposition:
$ref: "#/definitions/CountAndFreq"
remedied:
$ref: "#/definitions/CountAndFreq"
remedy_in_progress:
$ref: "#/definitions/CountAndFreq"
no_action:
$ref: "#/definitions/CountAndFreq"
total:
$ref: "#/definitions/CountAndFreq"
with_mfr_notes:
$ref: "#/definitions/CountAndFreq"
CountAndFreq:
type: object
additionalProperties: false
required:
- freq
- count
properties:
freq:
type: string
count:
type: integer