Swagger 如何在OpenAPI规范中将空字符串值指定为字符串类型属性的默认值

Swagger 如何在OpenAPI规范中将空字符串值指定为字符串类型属性的默认值,swagger,openapi,swagger-codegen,openapi-generator,Swagger,Openapi,Swagger Codegen,Openapi Generator,我有一个开放的api yaml文件,如下所示。我想将空字符串值指定为字符串类型属性的默认值。这样做的方法是什么 Test: type: object required: ['', ''] properties: test1: type: string default: " " 相当肯定的是: 默认值:“ 也就是说,没有空格。如果默认值为“”,则招摇字符串类型显示“string” 以下是问题主题:字符串数据类型的默认值为“”。@user3128995您能澄清一下“不工作”

我有一个开放的api yaml文件,如下所示。我想将空字符串值指定为字符串类型属性的默认值。这样做的方法是什么

  Test:
type: object
required: ['', '']
properties:
  test1:
    type: string
    default: " "
相当肯定的是:

默认值:“

也就是说,没有空格。

如果默认值为“”,则招摇字符串类型显示“string”


以下是问题主题:

字符串数据类型的默认值为“”。@user3128995您能澄清一下“不工作”是什么意思吗?它到底在哪里不起作用?您希望得到什么样的结果?实际结果是什么?请注意:
required:['',]
很可能不是有效的语法。
required
列表应该包含该对象的实际属性名称,例如
required:[test1]
default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.