Swagger - 属性 名称约定

Swagger - property name convention

我以前在设计 API 时,无论是 2.0 还是 3.0 版本,我都使用 属性 名称的驼峰命名法。这次我可能有必要为 属性 名称使用嵌入的下划线和大写字母。这是openapi允许的吗?我可以使用混合模式吗?

我搜索了 属性 名称的命名约定,但没有找到。

谢谢

据我所知,任何有效的字符串都是允许的。引用和转义可以创建有效的字符串。

所有这些都有效:

  foo-bar:
    type: string
  foo_bar:
    type: string
  'foo-bar':
    type: string
  'foo_bar':
    type: string
  "foo_bar":
    type: string
  "foo bar":
    type: string
  foo bar:
    type: string
  "foo: bar":
    type: string