-
Notifications
You must be signed in to change notification settings - Fork 6k
Passing of parameters and supporting files is a bit clunky #643
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
Comments
@smartytime It sounds like #616 will solve some of your concerns. Please have a look and provide some feedback. |
Cool - looks good. I love the idea of a json config object -- something structured that could also account for adding supporting files. I'd personally rather just use that than worry about passing a ton of command line args. The only other thing that would be really nice IMO is a simple way to add basic transfromations to the model (without having to recompile swagger-codegen). Sometimes you want to make the first letter lowercase, or combine two fields. It would be really nice to be able to do something like that without having to create or modify a Codegen class. |
@smartytime - Since #616 covers the configuration aspects, can you add your comments there so we can consolidate issues? As for the transformations, I'd suggest opening a separate feature request for it. It's an interesting idea. |
Hello, #616 has been closed. It was a really great improvement on additionalProperties but unfortunately, it is still impossible to add supportingFiles via a config file and the only way is to modify the generator itself. I think since supportingFiles depend on additionalProperties, it is not as easy to implement. Maybe the JSON file could contain mustache-like syntax to reuse the previously set additionalProperties. |
@cbornet do you mind sharing with me the additional file you want to include? What's the purpose of that additional file? |
@wing328 the point is to have the user define its own additional files depending on what he wants to do. @smartytime gives the example of generating a gradle file instead of a pom but there are a lot of other possibilities. |
OK for now, you can't supply arbitrary files to the generation command. They have to be mapped via code. We'll add support for another mechanism to do so but for now, it's simply not possible and not a defect. Please open a new ticket if you have suggestions on the syntax or behavior and it can be considered for the next release. |
We have several projects that we'd like to generate sdks for (java). They each have potentially different package names, groupIds, artifactIds, and version. Additionally, we are doing some slightly different things with the generation (gradle instead of maven, etc).
Right now, swagger-codegen requires too much changing of code within the actual swagger-codegen project IMO, whereas most of what we're doing is simply passing in parameters to be accessed in the template models. Also, the only way to add supporting files is to modify the swagger-codegen classes.
If we had the ability to read a properties file that could modify any of the core properties (packages, artifacts, versions, etc), and another file that could specify additional supporting files, I believe we could make do with the vanilla Java client codegen. So, I started modifying the Generate class to read these files, but now I'm running into the problem that these properties are scoped protected, so I can't set on the Codegen class itself. So, I added them to additionalProperties (I saw that someone else had done this with templateDir), but the read patterns are inconsistent - everything ends up in a Model eventually, but there are helper methods for determining folders, eg.JavaClientCodgen.modelFileFolder() that still read the protected property.
I can see two solutions:
The text was updated successfully, but these errors were encountered: