我有一个 OpenAPI v3 规范文件,其中包含以下内容(仅显示片段):
paths:
/global/name:
get:
description: Some description
tags:
- Global settings
operationId: getGlobalSettingsName
responses:
# Response code
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/globalSettingsName'
components:
schemas:
globalSettingsName:
type: object
properties:
name:
type: integer
description: 'ID'
example: 1
required:
- name
但服务器响应是:
{
"name": "somestring"
}
请注意,名称属性类型是integer
并且在服务器响应中,它是string
(故意)但dredd
请求通过(成功)。
不dredd
检查响应属性类型?
我将响应重新定义为string
(不是 JSON):
responses:
# Response code
'200':
description: Successful response
content:
application/json:
schema:
type: string
也不dredd
抱怨。
我什至改变了模式的属性:
globalSettingsName:
type: object
properties:
www:
type: string
description: 'some description'
example: 'somestring'
required:
- www
当预期失败时,结果相同(成功)。
这些验证不支持dredd
吗?我使用规范错误吗?