Skip to content

Payload property named message breaks with null value #863

Description

@ly29

Payload property named message breaks with null value

          "type": "object",
          "properties": {
            "message": {
              "type": ["string", "null"],
              "maxLength": 50
            }
          },
          "required": ["message"],
        },
        "examples": [{
            "name": "return",
            "payload": {
              "message": null
            }
          }
        ]
      }

It breaks rendering of the asyncapi spec, validation does not give valid errors and studio.asyncapi.com breaks

Expected result
It works and renders. Note that this works if the message property is renamed or given a non null example value.

Actual result

The following error is given

	Error thrown during AsyncAPI document validation. Name: Error, message: jsonPath: Cannot read properties of null (reading 'schemaFormat'): _$_property === 'message' && _$_v.schemaFormat === void 0, stack: Error: jsonPath: Cannot read properties of null (reading 'schemaFormat'): _$_property === 'message' && _$_v.schemaFormat === void 0 at v._eval (https://studio.asyncapi.com/static/js/main.f7f7093d.js:2:4494941) at https://studio.asyncapi.com/static/js/main.f7f7093d.js:2:4491179 at https://studio.asyncapi.com/static/js/main.f7f7093d.js:2:4493697 at Array.forEach (<anonymous>) at v._walk (https://studio.asyncapi.com/static/js/main.f7f7093d.js:2:4493676) at v._trace (https://studio.asyncapi.com/static/js/main.f7f7093d.js:2:4491130) at v._trace (https://studio.asyncapi.com/static/js/main.f7f7093d.js:2:4490522) at https://studio.asyncapi.com/static/js/main.f7f7093d.js:2:4490621 at https://studio.asyncapi.com/static/js/main.f7f7093d.js:2:4493697 at Array.forEach (<anonymous>)

Steps to reproduce

Paste the following gist into the asyncapi studio
https://gist.github.com/ly29/6b56cc8252ad48ac681f19ea468d540f

Troubleshooting
I have reduced the issue down to one specific property that breaks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions