parser-js: AsyncAPI reference to Avro [BUG]

Describe the bug I try to make a reference to an Avro object in AsyncAPI. For development, I used playground.asyncapi.io. When defining a reference to our Kafka Schema Registry, which returns Avro like in your documentation

"Train": {
  "name": "Train",
  "title": "Train Information",
  "summary": "Inform about Trains.",
  "schemaFormat": "application/vnd.apache.avro+json;version=1.9.0",
  "payload": {
    "$ref": "https://schema-registry-dev.app.01d.io.sbb.ch/subjects/kafka.my-schema-value/versions/1#Train"
  }
}

the reference gets correctly resolved to

"Train": {
  "name": "Train",
  "title": "Train Information",
  "summary": "Information about trains.",
  "payload": {
    "subject": "kafka.my-schema-value",
    "version": 1,
    "id": 1,
    "schema":   
        {
          "type": "record",
          "name": "Train",
          "namespace": "ch.sbb.kafka.platform.model",
          "fields": [
            {
              "name": "model",
              "type": "string"
            },
            {
              "name": "manufacturer",
              "type": "string"
            }
          ]
        }
    }
}

this means that the reference itself and the link is working correctly. But when you then check the HTML panel in playground, the payload object is displayed as “”, instead of the object. Do I miss something here or is the playground component broken?

To Reproduce Steps to reproduce the behavior:

  1. Open playground.asyncapi.io
  2. Enter an AsyncAPI document with a reference to Avro as described above.
  3. The reference gets resolved automatically.
  4. Check right HTML panel for the operation that included the reference. Payload is “” instead of the object.

Expected behavior Object is being displayed in JSON.

Screenshots I have a screenshot. How do I add it to this bug report?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

I just updated playground.asyncapi.io to have support for Avro schemas. Feel free to try it!

Example document:

asyncapi: 2.0.0
info:
  title: Example with Avro
  version: 0.1.0
channels:
  example:
    publish:
      message:
        schemaFormat: 'application/vnd.apache.avro;version=1.9.0'
        payload: # The following is an Avro schema in YAML format (JSON format is also supported)
          type: record
          doc: User information
          fields:
            - name: displayName
              type: string
            - name: email
              type: string
            - name: age
              type: int

This is the package doing the magic: https://github.com/asyncapi/avro-schema-parser.

I’m closing this issue but feel free to open new ones on the Avro Schema Parser repo.