Skip to content

SchemaViewer (Avro): (nested) object fields inside "type" object arrays are not rendered #1848

@mumundum

Description

@mumundum

I tried this:

Using an Avro schema where a field’s "type" is an array (object), the array’s items value is another object with its own fields, for example:

{
    "name": "EventId3",
    "doc": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr.",
    "type": {
    "type": "array",
    "items": {
      "type": "record",
      "name": "EventReference",
      "namespace": "Events.Structures",
      "fields": [
        {
          "name": "EventId",
          "doc": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr.",
          "type": "string"
        },
        {
          "name": "Topic",
          "doc": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr.",
          "type": "string"
        }
      ]
    }
  }
},

This happened:

The SchemaViewer (Avro) renders the first layer, but not the nested fields:

Image

I expected this:

The fields of the object, used as the array’s items, should be expanded.
Similar to how nested fields are rendered when part of direct type object, for example:

Image
{
    "name": "UserId2",
    "doc": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr.",
    "type": {
    "name": "Reference",
    "namespace": "Events.ProtectedData",
    "doc": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr.",
    "type": "record",
    "fields": [
      {
        "name": "Id",
        "type": "string",
        "doc": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr."
      },
      {
        "name": "Topic",
        "type": "string",
        "doc": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr."
      },
      {
        "name": "Url",
        "type": [
          "null",
          "string"
        ],
        "default": null,
        "doc": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr."
      }
    ]
  }
},

Is there a workaround?

None found.

Anything else?

It doesn't seem to matter if the array object is part of a union, or not.

Example schema with different options: example.txt

EventCatalog Version

@eventcatalog/core@2.64.4; @eventcatalog/core@2.65.0-beta.2

Node.js Version

v22.16.0

Platform(s)

Windows, Linux

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcoreIssues related to @eventcatalog/core package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions