我有一个包含以下内容的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"
}注意,name属性类型是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不支持这些验证吗?我是不是用错了规范?
发布于 2019-03-20 00:44:07
导致当前版本(8.0.5)仅支持content中的example值:https://github.com/apiaryio/dredd/issues/1281
https://stackoverflow.com/questions/55240826
复制相似问题