-
-
Notifications
You must be signed in to change notification settings - Fork 157
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: generate example function for TypeScript models #568
Conversation
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide 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.
There is a problem in the code formatting and I don't know how to resolve it. Please if anyone can help me with it. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
presets.push({ | ||
preset: TS_COMMON_PRESET, | ||
options: { | ||
marshalling: true | ||
} | ||
}, |
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.
Do you see that the same preset are added twice now, just with slightly different options? 🙂
This should not be the case, it can only be added once, and then the options should change slightly based on the parameters 🙂
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.
It is not getting added twice even if there are both flags in the command of tsExampleInstance
and tsJsonBinPack
. I think Modelina has the support for this where the same preset is added with multiple values of options then it gets combined to give the output. Just the order of the functions generated is getting changed somewhat rest is the same for me.
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.
Another approach would be to create an object variable
const options={
example : tsExampleInstace ,
marshalling : tsMarshalling
}
presets.push({
preset: TS_COMMON_PRESET,
options:options
})
and then use this while pushing the presets which can also resolve #460
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.
Ahh you right, it's allowed as long as the options don't overlap or default behavior adds some stuff. Because otherwise it will be added twice 😄
Description
tsExampleInstance
which if true adds an example of the model generated .Related issue(s)
Resolves #462