Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Problem with type names in Avro unions #1032

Closed
YuriiKondratov opened this issue Jul 17, 2024 · 2 comments · Fixed by #1039
Closed

[BUG] Problem with type names in Avro unions #1032

YuriiKondratov opened this issue Jul 17, 2024 · 2 comments · Fixed by #1039
Labels

Comments

@YuriiKondratov
Copy link

YuriiKondratov commented Jul 17, 2024

Description

When I generate HTML from asyncapi specification referencing Avro schema with unions, I get unexpected "Adheres to undefined.... Or to undefined...." construct.

To reproduce bug create file "OuterRecord.avsc" with schema:

{
  "type" : "record",
  "name" : "OuterRecord",
  "doc" : "OuterRecord docstring",
  "fields" : [ {
    "name" : "innerRecord",
    "type" : [ {
      "type" : "record",
      "name" : "InnerRecord1",
      "doc" : "InnerRecord1 docstring",
      "fields" : [ {
        "name" : "innerRecord1Field",
        "type" : "string",
        "doc" : "innerRecord1Field docstring"
      } ]
    }, {
      "type" : "record",
      "name" : "InnerRecord2",
      "doc" : "InnerRecord2 docstring",
      "fields" : [ {
        "name" : "innerRecord2Field",
        "type" : "string",
        "doc" : "innerRecord2Field docstring"
      } ]
    } ],
    "doc" : "innerRecord docstring"
  } ]
}

and file "asyncapi.yaml" with specification:

asyncapi: 3.0.0
info:
  title: Bug Illustrating API
  version: 1.0.0
  description: The API illustrates Asyncapi generator bug
servers:
  kafkaServer:
    host: test.mykafkacluster.org:8092
    description: Kafka Server
    protocol: kafka
operations:
  onExampleEvent:
    action: receive
    channel:
      $ref: '#/channels/exampleEvent'
channels:
  exampleEvent:
    description: Example channel
    address: example_addr
    messages:
      exampleMessage:
        $ref: '#/components/messages/exampleMessage'
components:
  messages:
    exampleMessage:
      payload:
        schemaFormat: 'application/vnd.apache.avro;version=1.9.0'
        schema:
          $ref: './OuterRecord.avsc'

then generate HTML using

npm install -g @asyncapi/cli
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/[email protected]

Expected result

In section Messages.Payload.innerRecord I expect to see "Adheres to InnerRecord1 .... Or to InnerRecord2 ...."

Actual result

I get "Adheres to undefined.... Or to undefined...."

image

Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 2.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants