gpt4 book ai didi

Swagger 2.0 Anyof

转载 作者:行者123 更新时间:2023-12-04 03:36:43 25 4
gpt4 key购买 nike

Swagger 2.0 版中的 anyof 相当于什么,请告诉我如何更新我的 json 文件,因为我想将我的文档从 swagger 1.0 升级到 2.0。

感谢您的帮助。

最佳答案

我认为没有,感觉是一个很大的缺点。在the Schema Object portion of the specification中绝对没有提到它.他们调用了从 JSON Schema 和 anyOf 中采用的元素。不在其中:

The following properties are taken directly from the JSON Schema definition and follow the same specifications:

  • $ref - As a JSON Reference
  • format (See Data Type Formats for further details)
  • title
  • description (GFM syntax can be used for rich text representation)
  • default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object)
  • multipleOf
  • maximum
  • exclusiveMaximum
  • minimum
  • exclusiveMinimum
  • maxLength
  • minLength
  • pattern
  • maxItems
  • minItems
  • uniqueItems
  • maxProperties
  • minProperties
  • required
  • enum
  • type

The following properties are taken from the JSON Schema definition but their definitions were adjusted to the Swagger Specification. Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the Schema Object definition is used instead.

  • items
  • allOf
  • properties
  • additionalProperties


我认为最接近的是 discriminator字段,但这意味着您必须构建输出以适应 Swagger。

关于Swagger 2.0 Anyof,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34863160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com