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

Template doesn't like "array" type in schema #316

Open
Mrc0113 opened this issue Jan 11, 2023 · 3 comments
Open

Template doesn't like "array" type in schema #316

Mrc0113 opened this issue Jan 11, 2023 · 3 comments
Labels
bug Something isn't working stale

Comments

@Mrc0113
Copy link
Contributor

Mrc0113 commented Jan 11, 2023

Describe the bug

When using this code generator template it was spitting out an unclear error with the attached file asyncapi.zip. However once you remove the products part of the schema it works successfully. Since the provided asyncapi file is valid I assume this template does not properly handle schemas that use an object with the array type at this level.

 /tmp  ag -o TEST asyncapi.json https://github.com/asyncapi/java-spring-cloud-stream-template.git                                                                                                                                      1 ✘
Something went wrong:
Template render error: (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/@asyncapi/java-spring-cloud-stream-template/template/src/main/java/$$everySchema$$.java)
  Template render error: (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/@asyncapi/java-spring-cloud-stream-template/partials/java-package) [Line 5, Column 49]
  TypeError: prop.items(...).type is not a function
    at Object._prettifyError (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/lib.js:36:11)
    at /Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:563:19
    at eval (eval at _compile (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:633:18), <anonymous>:19:11)
    at /Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:571:11
    at Template.root [as rootRenderFunc] (eval at _compile (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:633:18), <anonymous>:50:3)
    at Template.render (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:552:10)
    at eval (eval at _compile (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:633:18), <anonymous>:18:10)
    at fn (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/a-sync-waterfall/index.js:26:24)
    at /Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/a-sync-waterfall/index.js:66:22
    at executeSync (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/a-sync-waterfall/index.js:8:15)
    at /Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/a-sync-waterfall/index.js:65:11
    at eval (eval at _compile (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:633:18), <anonymous>:14:1)
    at Environment.getTemplate (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:279:9)
    at eval (eval at _compile (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:633:18), <anonymous>:12:5)
    at fn (/Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/a-sync-waterfall/index.js:26:24)
    at /Users/Mdipasquale/.nvm/versions/node/v18.7.0/lib/node_modules/@asyncapi/generator/node_modules/a-sync-waterfall/index.js:66:22

How to Reproduce

Download attached asyncapi.zip file.
Run ag -o TEST asyncapi.json https://github.com/asyncapi/java-spring-cloud-stream-template.git

Expected behavior

A successful project should be generated

@Mrc0113 Mrc0113 added the bug Something isn't working label Jan 11, 2023
@CameronRushton
Copy link
Member

@Mrc0113 I think the asyncapi doc provided is the one that is successful, yeah? The one with products removed.

@Mrc0113
Copy link
Contributor Author

Mrc0113 commented Feb 2, 2023

Sorry @CameronRushton, I think this is the right file
asyncapiWithProducts.json.zip

@github-actions
Copy link

github-actions bot commented Jun 3, 2023

This issue has been automatically marked as stale because it has not had recent activity 😴

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 ❤️

@github-actions github-actions bot added the stale label Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

2 participants