我有一个打开的 api yaml 文件,如下所示。我想将空字符串值作为默认值分配给字符串类型属性。这样做的方法是什么
Test:
type: object
required: ['', '']
properties:
test1:
type: string
default: " "
我有一个打开的 api yaml 文件,如下所示。我想将空字符串值作为默认值分配给字符串类型属性。这样做的方法是什么
Test:
type: object
required: ['', '']
properties:
test1:
type: string
default: " "
很确定是:
默认: ””
也就是说,其中没有空格。
如果默认为“”,则 Swagger 字符串类型显示“字符串”。
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.
这是问题主题:https ://github.com/swagger-api/swagger-codegen/issues/43