-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Ability to only generate model classes #139
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup 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. |
Hey @garethahealy. That is a completely valid use case. We do not have a single recommended approach here atm.
The preferred future approach is to base model generation on our new project https://github.com/asyncapi/modelina that will be integrated with our CLI, so you can explicitly ask the CLI for models only. This is not going to happen very quick though. I think the best would be to just add
|
@derberg ; i've already gone down the custom template route: https://github.com/garethahealy/java-spring-template re: I couldn't see how to do that via: https://github.com/asyncapi/generator/blob/c369b8542ab6791546e864664ce0eba14ed7942b/lib/generator.js#L102-L129 any ideas? If I do it in the |
if you want to hook in before then just name your hook
just to understand your flow, you use this template to bootstrap the initial service, and over time you want to regenerate only data models? I thought you need data models only |
I do only want the models. Typically, I'll bootstrap my project via mvn; in this case, it's an apache camel project. ideally, I'd like to hook up the Just to clarify the phases comment; the template includes files (i.e.: gradle) which I cant see how to stop being included via the hooks, because I don't see a way in the Does that make sense? |
did you try to check if you have access to before using this could even turn out to be a generic hook that anyone can later include in their templates. You could do this in the way that user can pass a simple parameter like another solution -> make it a generic feature of the generator. We already have there an option in the library to provide it would partially solve my problem from asyncapi/generator#581 or extend There are few options, hook would be just a workaround |
Hi i done this in the following branch of my fork https://github.com/micromata/java-spring-template/tree/feature/only_generate_model You only have to add -p onlyModel=true This branch also includes the possibility to use the discrimnator wit the allOf Pattern. I will open a PR soon but feel free to check it out |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
@tuxBurner best would be to check your work on a PR. Feel free to open just a draft PR for review |
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 ❤️ |
@tuxBurner @garethahealy any of you interested in opening a PR. Otherwise I will close as such stuff should be done with https://github.com/asyncapi/modelina imho |
@derberg ; I dont have the time currently to do a PR, so happy for it to be closed. |
Reason/Context
Please try answering few of those questions
Why we need this improvement?
Currently, the generator only works for greenfield projects. If I already have a project and adding in a new AsyncAPI, I need to do this in another directory and manually copy files over.
How will this change help?
Can make the generation of the model part of mvn and follow standard
target/generated-sources
flowWhat is the motivation?
I only need the model for my purposes. Most other spec -> generators support this flow (i.e.: swagger/openapi)
Description
Please try answering few of those questions
What changes have to be introduced?
Only the
model
classes should be generated, everything else would be skipped.Will this be a breaking change?
I'd expect not, as it would be another
param
which controls the flowHow could it be implemented/designed?
Not sure, I had a quick look but it seems the generators copy files over and then process them. would need the ability to control what is copied into the target directory.
The text was updated successfully, but these errors were encountered: