在下面的OpenAPI定义中,参数定义导致解析器错误"bad indentation of a mapping entry"
。怎么了?"属性"出错(最后5行)
responses:
'200':
description: OK
content:
application/json;charset=UTF-8:
schema:
type: object
properties:
creationTime:
type: string
format: date-time
description: >-
The date and time the response was created in GMT time
with a format of "MM-dd-yyyy HH:mm:ss.SSSZ"
example: '03-12-2019 14:05:35.182-0500'
response:
type: array
description: ''
properties:
recordID:
type: string
maxLength: 20
externalID:
由于properties
关键字比其兄弟type
和description
关键字缩进更多而出现错误。
response:
type: array
description: ''
properties: # <---- Indentation doesn't match the sibling
# `type` and `description` keywords
但是,type: array
模式需要items
,而不是properties
。
response
键要么缺少一些关键字,要么有额外的关键字。response
的正确定义应该是:
response:
type: object # <----------
description: ''
properties: # <----------
recordID:
type: string
maxLength: 20
externalID:
...
或
response:
type: array
description: ''
items: # <----------
type: object # <----------
properties: # <----------
recordID:
type: string
maxLength: 20
externalID:
...
取决于你需要什么