3

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

  Test:
type: object
required: ['', '']
properties:
  test1:
    type: string
    default: " "
4

2 回答 2

0

很确定是:

默认: ””

也就是说,其中没有空格。

于 2019-06-29T18:03:45.097 回答
0

如果默认为“”,则 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

于 2021-01-26T12:09:49.357 回答