asyncapi-react
asyncapi-react copied to clipboard
AsyncAPI renderer crashing
Hi everybody,
I've noticed that on following AsyncAPI 2.6.0 document, the renderer catastrophically crashes. There is no way of recovery. This also manifest in https://studio.asyncapi.com/ where the document is stored in local storage under document
key and subsequent refreshes results in never ending splash screen.
Affected version: @asyncapi/react-component =1.0.0-next.48
Document:
asyncapi: '2.6.0'
info:
title: AsyncAPI
version: '1.0.0'
channels:
'foo':
description: Bar.
publish:
message:
oneOf:
- $ref: '#/components/messages/Foo'
components:
messages:
Foo:
name: Foo
payload:
$ref: "#/components/schemas/Bar"
examples:
- name: standard
payload:
after:
oneOf:
- $ref: '#/components/messages/Foo'
schemas:
Bar:
type: object
properties:
eventType:
type: string
desciption: Foo
Never ending splash screen:
@char0n Circular references in message examples aren't supported, only in schemas.
@magicmatatjahu yep I do understand that, thus I would expect the renderer to treat the $ref
field as normal field name without any significance. Even if it would be supported still I wouldn't expect the render to crash and properly recover.
Just describing my understand of Message Example Object
.payload
field in more detail here. The specification for AsyncAPI 2.6 says:
any
means that arbitrary data can be provided there and no special processing happens.
The parser tries to resolve the references and we do not exclude the refs in the payload's examples, they are still resolved. In addition, the validator checks whether the example from payload agrees with the schema defined in payload. In your case, your schema would not pass anyway - so Message Example Object.payload is not "any" in the sense of parser/validator.
Right, so it's basically an arbitrary data
(that's what any
means for me) that needs to be validated later against Message.payload
, but it's still just data
. If the Message.payload
is defined as empty schema {}
then the validation would always pass. But that's not the issue here.
asyncapi: '2.6.0'
info:
title: AsyncAPI
version: '1.0.0'
channels:
'foo':
description: Bar.
publish:
message:
oneOf:
- $ref: '#/components/messages/Foo'
components:
messages:
Foo:
name: Foo
payload:
$ref: "#/components/schemas/Bar"
examples:
- name: standard
payload:
after:
oneOf:
- $ref: '#/components/messages/Foo'
schemas:
Bar: {}
The issue seem to be in following:
The parser tries to resolve the references and we do not exclude the refs in the payload's examples
This shouldn't happen, it seems that the tooling goes outside the spec here. But that's not what concerns me as well.
What concerns me is that the actual crash happens. In AsyncAPI studio you see the white screen, and after the reload you'll just see the splash screen indefinitely. You need to know how to delete localStorage
to be able to work with https://studio.asyncapi.com/ again.
This issue has been automatically marked as stale because it has not had recent activity :sleeping:
It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.
There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.
Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.
Thank you for your patience :heart:
Still reproducible in latest studio version.