【问题标题】:What is the correct way to declare a 'char' in an OpenAPI/Swagger-file?在 OpenAPI/Swagger 文件中声明“char”的正确方法是什么?
【发布时间】:2021-03-04 06:52:02
【问题描述】:

在 OpenAPI/Swagger 文件中声明“char”的正确方法是什么?我试过这些..但没有用

myTestProperty:
    type: char
    example: C or B

我也这样累,但没有运气

myTestProperty:
    type: string
    format: char
    example: C or B

文档确实特别提到了 char 数据类型,但在其他地方也找不到。

请提出建议。

【问题讨论】:

    标签: swagger openapi swagger-codegen openapi-generator


    【解决方案1】:

    OpenAPI 中没有 char 数据类型。最接近的近似值是 string,其 minLengthmaxLength 均为 1。

    exampleProperty:
      type: string
      minLength: 1
      maxLength: 1
    

    【讨论】:

      猜你喜欢
      • 2018-08-28
      • 1970-01-01
      • 2019-05-09
      • 2016-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-17
      相关资源
      最近更新 更多