问题描述
我有一个 OpenAPI 3.0.1 文件并且符合标准,它包含一些端点响应示例。现在,由于响应中的某些参数设置为 nullable
,因此一些示例如下所示:
examples:
account_not_verified:
value:
eamil: 'test@example.com'
verification: '0'
name: null
由于 name
参数是这样设置的:
name:
type: string
nullable: true
我认为示例响应中的空值对开放 api 标准是有效的。当我将其放入 Swagger 编辑器时,不会显示任何错误或警告。但是一旦我将 OpenAPI 文件包含到我的 sam 模板中以用于配置 HTTP API 网关,如下所示:
ApiGateway:
Type: AWS::Serverless::HttpApi
Properties:
StageName: !Ref Stage
FailOnWarnings: true
DeFinitionBody:
Fn::Transform:
Name: AWS::Include
Parameters:
Location: ./oapi.yml
云的形成给了我以下错误:
[/Resources/ApiGateway/Type/Body/paths/***/content/application/json/examples/ch_account_not_verified/value/name] 'null' values are not allowed in templates
有什么方法可以让这个 null
值存在于示例响应中,还是我必须使用一些不同的方法来指示示例中的 null
值?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)