Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spread syntax requires #694

Open
atiapa-payall opened this issue Jan 19, 2024 · 1 comment
Open

Spread syntax requires #694

atiapa-payall opened this issue Jan 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@atiapa-payall
Copy link

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:
- $ref: '#/channels/example/messages/request'
reply:
channel:
$ref: '#/channels/example'
messages:
- $ref: '#/channels/example/messages/response'
- $ref: '#/channels/example/messages/errorRes'

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.

@atiapa-payall atiapa-payall added the bug Something isn't working label Jan 19, 2024
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant