-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
feat: enable string input for generate
#1039
Conversation
I cant for the life of me disable or ignore the sonar cloud issues. If anyone knows how do let me know.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case of sonar, just remove these NOSONAR
comments and modify https://github.com/asyncapi/generator/blob/master/.sonarcloud.properties
just exclude all tests like test/**/*
for cognitive complexity, put this before the function /* eslint-disable sonarjs/cognitive-complexity */
also please adjust title, it is a feat imho because of deprecation. So write what you change and not what you fix
This is not respected by sonar.
Added 👍
Alright 👍 |
generate
@jonaslagoni chatGPT wrote it is possible to add |
@derberg yea but that will just increase global threshold, not really ignoring single function 😅 |
@jonaslagoni which is ok right? better just increase threshold, and then we should worry when we go beyond, and see what we can do, rather than just silent forever? |
I guess 😄 Updated it. |
looks like chatGPT lied 😅 yeah, remove the fake setting (including |
Had to leave the Did a quick test with the HTML template re-write just to make sure everything still worked as expected with v3 documents. And found a problem with tests and implementation. @derberg should be all ready for the final review now ✌️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check with other templates, that are not yet migrated, like for example nodejs-template
I'm getting:
# running from local from fix_v3_support branch
$ ./cli.js https://bit.ly/asyncapi @asyncapi/nodejs-template -p server=production -o lolo --force-write
Something went wrong:
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at Object.writeFileSync (node:fs:2146:5)
at createAsyncapiFile (/Users/xxx/generator/node_modules/@asyncapi/generator-hooks/src/index.js:28:6)
at /Users/xxx/generator/lib/generator.js:827:20
at Array.map (<anonymous>)
at Generator.launchHook (/Users/xxx/generator/lib/generator.js:824:28)
at Generator.generate (/Users/xxx/generator/lib/generator.js:208:18)
at async /Users/xxx/generator/cli.js:159:9
error comes from console log in the location
returns
and yeah, I checked, |
@derberg not sure why I removed it 🤔 |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Fixed it and added it to the tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! 🚀
will you create the followup for cognitive stuff or want me to?
If you got time please do 👍 Heading over to the templates right now to fix the remaining stuff so they are ready to be reviewed as well. |
Thanks @derberg 👍 |
/rtm |
done #1040 |
🎉 This PR is included in version 1.13.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This feature was driven by the following problems that needed to be fixed:
Parser-API
version 2 support #1017 I did not know that CLI usedgenerateFromString
instead of generate, and that was not changed at all.generateFromString
parses the document with the old parser, and that means it cannot understand v3 documents.Changes:
generateFromString
is being deprecated andgenerate
should be used instead.generate
now handles string inputs and parses the document according to the template configurationapiVersion
validateTemplateConfig
now accesses the server object according to the parser APIRelated issue(s)
Fixes #1038