asyncapi / java-spring-cloud-stream-template

Java Spring Cloud Stream template for the AsyncAPI Generator
31 stars 33 forks source link

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

Open Mrc0113 opened 1 year ago

Mrc0113 commented 1 year ago

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

CameronRushton commented 1 year ago

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

Mrc0113 commented 1 year ago

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

github-actions[bot] commented 1 year 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: