asyncapi / glee

Glee — The AsyncAPI framework that will make you smile again :)
87 stars 62 forks source link

Spread syntax requires #694

Closed atiapa-payall closed 1 month ago

atiapa-payall commented 9 months ago

Describe the bug

When generating documents with glee docs, if you place more than one element in operations/'operation'/response/messages, glee throws the following error:

$ glee docs ⓘ Generating docs for your parsed specification... x Spread syntax requires ...iterable[Symbol.iterator] to be a function at new Collection (/home/atiapa/Documents/proyectos/betjockey/bingo-api/server/node_modules/parserapiv3/cjs/models/collection.js:6:9) at new map (/home/atiapa/Documents/proyectos/betjockey/bingo-api/server/node_modules/parserapiv3/cjs/models/v3/messages.js:5:1) at Messages.map () at OperationReply (/home/atiapa/Documents/proyectos/betjockey/bingo-api/server/node_modules/@asyncapi/markdown-template/components/Operations.js:280:58) at createElement (/home/atiapa/Documents/proyectos/betjockey/bingo-api/server/node_modules/@asyncapi/generator-react-sdk/src/renderer/renderer.ts:46:26) at /home/atiapa/Documents/proyectos/betjockey/bingo-api/server/node_modules/@asyncapi/generator-react-sdk/src/renderer/renderer.ts:70:26 at Array.map () at render (/home/atiapa/Documents/proyectos/betjockey/bingo-api/server/node_modules/@asyncapi/generator-react-sdk/src/renderer/renderer.ts:69:26) at normalizeProps (/home/atiapa/Documents/proyectos/betjockey/bingo-api/server/node_modules/@asyncapi/generator-react-sdk/src/renderer/renderer.ts:12:22) at createElement (/home/atiapa/Documents/proyectos/betjockey/bingo-api/server/node_modules/@asyncapi/generator-react-sdk/src/renderer/renderer.ts:46:31)

This error only occurs when you use the '@asyncapi/glee' package with its 'glee docs' command, in the 'Studio beta' it works perfectly. I entered the error in gpt chat for a more complete reference and it told me the following:

The error you are experiencing is not related to the content of the YAML file you are trying to generate. The error comes from the glee tool and is related to the spread syntax in JavaScript.

The error message indicates that ...iterable[Symbol.iterator] is required to be an iterable function for the hash syntax to work correctly. The code mentioned in the error message (collection.js, messages.js, etc.) belongs to the dependencies of parserapiv3, which appears to be used by glee.

To fix this issue, you can try the following:

 Make sure you have the correct version of parserapiv3 installed and that it is compatible with the version of glee you are using.
 Check if there are any updates available for glee and its dependencies, especially parserapiv3.
 If the problem persists, consider reporting the problem to the glee developers or seeking help from the glee community.

Note that the problem is not directly related to the content of the YAML file you are trying to generate, but rather to the glee tool and its integration with the underlying dependencies.

How to Reproduce

Steps to reproduce the issue. Attach all resources that can help us understand the issue:

example: asyncapi.yaml file

channels: example: address: 'example' description: ....... messages: request: name: request payload: type: boolean description: ........... response: name: response payload: type: array items: type: object properties: room_id: type: string description: ID de la sala. errorRes: name: errorRes payload: type: boolean description: ...........

operations: 'example': action: 'send' summary: example. channel: $ref: '#/channels/example' messages:

Expected behavior

Running 'glee docs' is expected to generate the project's docs, more specifically that that segment of the code that fails, will generate a list of possible responses that you can receive from the operation.

github-actions[bot] commented 9 months ago

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.

github-actions[bot] commented 5 months ago

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: