java-spring-cloud-stream-template icon indicating copy to clipboard operation
java-spring-cloud-stream-template copied to clipboard

Template doesn't like "array" type in schema

Open Mrc0113 opened this issue 2 years ago • 3 comments

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 avatar Jan 11 '23 21:01 Mrc0113

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

CameronRushton avatar Feb 02 '23 00:02 CameronRushton

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

Mrc0113 avatar Feb 02 '23 18:02 Mrc0113

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:

github-actions[bot] avatar Jun 03 '23 00:06 github-actions[bot]