Asyncapi allOf可重用架构在html渲染中创建数组而不是统一对象

问题描述

我正在尝试编写我的第一个Asyncapi文档文件。我想在reusableModel和其他模型之间执行我的模式的可重用性。但是,html文档预览为我提供了一个包含单独对象而不是一个统一对象的数组。这是我有问题的Yaml内容

asyncapi: 2.0.0
info:
  title: woaw
  version: 0.1.0
  description: >
    blabla
  license:
    name: UNLICENSED
defaultContentType: application/json
channels:
  myChannel:
    subscribe:
      message:
        oneOf:
          - $ref: '#/components/messages/new'
          - $ref: '#/components/messages/deleted'
          
components:
  messages:
    new:
      payload:
        $ref: '#/components/schemas/new'
    deleted:
      payload:
        $ref: '#/components/schemas/deleted'
        
  schemas:
    reusableModel:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 37a2005e-70e6-4cf3-b7e3-19e087879e50
    new:
      allOf:
        - $ref: '#/components/schemas/reusableModel'
        - type: object
          properties:
            type:
              type: string
              enum: ["extension.new"]
            data:
              type: object
              properties:
                key1:
                  type: object
                  properties:
                    users:
                      type: array
                      items:
                        type: string
                        
    deleted:
      allOf:
        - $ref: '#/components/schemas/reusableModel'
        - type: object
          properties:
            type:
              type: string
              enum: ["extension.deleted"]
            data:
              type: object
              properties:
                key1:
                  type: string

您可以将其复制/粘贴到https://playground/asyncapi.io以查看呈现问题。在第一个messageType(新)的有效负载中定义的allOf对象显示为数组,其中部分0为reusableModel,部分1为我的其余属性(类型+数据),而不是统一对象。 documentation涉及以下内容

AsyncAPI规范允许使用JSON Schema的allOf属性来组合和扩展模型定义,从而有效地提供了模型组合。 allOf接受一组对象定义的对象,这些对象定义经过独立验证,但一起组成一个对象。

我认为我对文档的某些部分有误解,您能向我解释吗?

解决方法

正如我所评论的,它看起来像是一个已知问题:

https://github.com/asyncapi/html-template/issues/11