Swagger 如何修复OpenAPI上不允许的其他属性?

Swagger 如何修复OpenAPI上不允许的其他属性?,swagger,openapi,openapi-generator,Swagger,Openapi,Openapi Generator,下面是我的最简单的工作示例:有一个开放式API模式,它传递一个: 当我运行redoc cli bundle openapi.yaml以使用生成html文档时,我可以看到: 问题是,我希望阶段的状态类型也是字符串(SearchFilter)类型,因此我尝试从属性复制粘贴其设置: components: schemas: ... PlayerStatus: type: object properties: phase: typ

下面是我的最简单的工作示例:有一个开放式API模式,它传递一个:

当我运行
redoc cli bundle openapi.yaml
以使用生成html文档时,我可以看到:

问题是,我希望
阶段
的状态类型也是
字符串(SearchFilter)
类型,因此我尝试从
属性
复制粘贴其设置:

components:
  schemas:
...
    PlayerStatus:
      type: object
      properties:
        phase:
          type: string
          x-extensible-enum: [READY, INJURED]
          example: READY
          schema:                                     // <----- added this line
            $ref: '#/components/schemas/SearchFilter' // <----- added this line

它看起来像是
不允许的附加属性:#/properties/phase的schema
是核心错误,我不确定如何修复它(我确实找到了带有相同错误的问题,但看起来错误的标题有点误导,因此它可能指示了大量不同的错误).

模式
在OpenAPI 3.0.x中的
模式中不是有效的关键字

您可能希望使用
allOf
来表示您的模式必须满足两个(或更多)子模式:

组件:
模式:
...
玩家状态:
类型:对象
特性:
阶段:
所有:
-类型:字符串
x-enum:[准备就绪,已损坏]
示例:准备好了吗
-$ref:“#/components/schemas/SearchFilter”

Schema现在通过验证程序,谢谢!也就是说,我遇到了另一个与渲染相关的问题:,你有什么想法吗?
components:
  schemas:
...
    PlayerStatus:
      type: object
      properties:
        phase:
          type: string
          x-extensible-enum: [READY, INJURED]
          example: READY
          schema:                                     // <----- added this line
            $ref: '#/components/schemas/SearchFilter' // <----- added this line
Swagger schema validation failed. 
  Data does not match any schemas from 'oneOf' at #/components/schemas/PlayerStatus
    Data does not match any schemas from 'oneOf' at #/components/schemas/PlayerStatus/properties/phase
      Additional properties not allowed: schema at #/properties/phase
      Missing required property: $ref at #/properties/phase
    Missing required property: $ref at #/components/schemas/PlayerStatus
  Data does not match any schemas from 'oneOf' at #/components/schemas/Player
    Data does not match any schemas from 'oneOf' at #/components/schemas/Player/properties/status
      Data does not match any schemas from 'oneOf' at #/properties/status/properties/phase
        Additional properties not allowed: schema at #/properties/phase
        Missing required property: $ref at #/properties/phase
      Missing required property: $ref at #/properties/status
    Missing required property: $ref at #/components/schemas/Player