-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
AnonymousSchema file is generated for Enum #1576
Comments
@magicmatatjahu @jonaslagoni @kennethaasan ask for comments |
Property names are seriously unstable to use as inferring names, which might work in some cases. Say we changed to use it, the behavior that Modelina would take is to merge those two models if they have the same ID. Would that be desirable? But would be happy to access a PR that adaptively changes the naming strategy of the AsyncAPI processor through an option, i.e. we can have multiple variants of this function:
Would you want to provide a PR for it @Tenischev ?
All individual models are generated into separate files with |
@jonaslagoni I want to mention that problem with naming will not occur if not generate dedicated class file for the parameter which is not an object by schema definition. Now, Modelina expand component model described in API and create a problem from this behaviour. |
Sure would be possible to do, but then if the same enum is referenced in multiple objects, you cannot reuse the instance across them because they will be in different packages 🙂
Each developer will have their own expectation of correct behavior, we will never be able to create a one-fits-all, that's why the tool enables you to mold it as you see it. |
This enum is a property of particular object. If API creator would like to reuse enum there all possibilities to make it clear from schema definition by placing it as a separate object. |
Modelina can't know that. We could enable customization through extensions that then control the algorithm slightly. Same with overwriting the behavior with options. Same with the processing, you are free to create your own processor, in your own repo that explicitly changes how the meta-models are created 🙂 All up to you.
Modelina doesn't care about it being an API. It only changes what is given, to ensure it's valid values in the language it's constrained in. Nowhere in any JSON Schema standard is it defined that the property should act as a name for the enum, it's one interpretation 🙂
If you want that go for it 😛 Modelina will enable you to do it for sure 👍 Just create your own generator, with split being all types, and add a renderer for it 😉 Enum + Classes is just something that every language offers, so it was standardized like that across generators. |
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 ❤️ |
Coming from openapi-generator-maven-plugin, I was also suprised by these generated AnonymousSchemaN Java classes that look a bit ugly. Sorry if I missed this in the discssion above, but what should I do to customize the enum class names ? |
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 ❤️ |
Describe the bug
AnonymousSchema class file is generated for Enum instead of Enum with normal name.
Issue is valid for both
JavaFileGenerator
andJavaGenerator
generators.Issue found during exploration of possibility to use Modelina for model generation in Java spring template, see #asyncapi/java-spring-template#342
How to Reproduce
AnonymousSchema_2
file. This file corresponds to enum property of element from the API:Expected behavior
The name of class file should be
Command
orCommandEnum
like the property name, notAnonymousSchema
.Also I do not see a reason to generate this Enum in a separate class file.
The text was updated successfully, but these errors were encountered: