asyncapi-react icon indicating copy to clipboard operation
asyncapi-react copied to clipboard

unrecoverable error in case of recursion in asyncapi document

Open catosaurusrex2003 opened this issue 1 year ago • 0 comments

Description As described in this issue https://github.com/asyncapi/studio/issues/771

when a document has got recursion in it

the rendering crashes due to too many recursion.

This causes the app to go into unrecoverable error.

Steps to reproduce:

  1. go to https://studio.asyncapi.com
  2. paste
asyncapi: 3.0.0
info:
  title: Account Service
  version: 1.0.0
  description: This service is in charge of processing user signups
channels:
  user/signedup:
    address: user/signedup
    messages:
      subscribe.message:
        $ref: '#/components/messages/TradeMessageServer'

components:
  messages:
    TradeMessageServer:
      name: Trade Message (server)
      title: Trade Message (server)
      description: A message containing trade data
      x-something: 
        $ref: '#/components/messages/TradeMessageServer' #RECURSION IS HAPPENING HERE !!! 

image the error in console image

Now Since studio fetches the document from localstorage before loading. Even if you reload the site it keeps on crashing again and again. Only way to recover is to clear the localstorage and start again with all the progress lost.

Expected result Application should not crash into an unrecoverable state.

The problem is in the recursion found in this function which doesnt have a recursion limit

Related Issues: https://github.com/asyncapi/studio/issues/771

catosaurusrex2003 avatar Oct 22 '24 17:10 catosaurusrex2003