Skip to content
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

[REQ] Conveniently only generate client classes #5800

Open
therealppa opened this issue Apr 2, 2020 · 6 comments
Open

[REQ] Conveniently only generate client classes #5800

therealppa opened this issue Apr 2, 2020 · 6 comments

Comments

@therealppa
Copy link

I often generate client code from a spec file with the maven plugin, like this:

        <configuration>
          <inputSpec>src/main/oas/oas.yaml</inputSpec>

          <generatorName>java</generatorName>
          <library>native</library>

          <configOptions>
            <dateLibrary>java8</dateLibrary>
          </configOptions>

          <apiPackage>${project.groupId}.client</apiPackage>
          <modelPackage>${project.groupId}.client</modelPackage>
          <invokerPackage>${project.groupId}.client</invokerPackage>

          <generateApiTests>false</generateApiTests>
          <generateModelTests>false</generateModelTests>
          <generateModelDocumentation>false</generateModelDocumentation>
          <generateApiDocumentation>false</generateApiDocumentation>
          <supportingFilesToGenerate>
            ApiException.java,Pair.java,ApiClient.java
          </supportingFilesToGenerate>
        </configuration>

It would be nice to have a single config property that disables the generation of tests, documentation and also all the supporting files that are not needed for compilation.

It would also be nice to be able to specify the package name only once if you want everything in the same package. packageName does not do this.

@therealppa therealppa changed the title [REQ] Convieniently only generate client classes [REQ] Conveniently only generate client classes Apr 2, 2020
@dragetd
Copy link

dragetd commented Apr 15, 2020

This seemes to be an ongoing wish back from the swagger times: swagger-api/swagger-codegen#1737

The clunky defaults and lack of proper documentation on how to bend those into shape is frustrating when working with it. Your example actually helped me a lot right now. :S

@Woodham
Copy link

Woodham commented Dec 9, 2020

Honestly personally I'd go so far as to say this should really be the default for how the maven plugin is configured. It's certainly unexpected that a maven codegen plugin by default generates a whole separate maven project.

@mikesaurus
Copy link
Contributor

+1 on this request.

We generate the client code as part of a larger parent project and have no use for anything but the Java class files, as the module that generates the client also compiles and builds the client jar. I would assume that setting generateSupportingFiles=true would have done the trick, but OAG "supporting" files are differ from my expectations since non-Java files are still generated while some of the Java files required to compile the client are not.

I agree with @Woodham that it seems like generating all-and-only source files should be the default behavior with an option to generate "supporting" files. But I would definitely settle for it being optional behavior with a param allowing me to toggle it on.

Hope that this is considered for an upcoming release. 🤞

@therealppa
Copy link
Author

So is there any chance this would ever get picked up?

@ppa-fyayc
Copy link

To my knowledge, nothing has changed in this area. Right?

@wing328
Copy link
Member

wing328 commented Mar 13, 2024

I don't think anyone has started working on this yet. I've some ideas.

Would you like to contribute a PR or sponsor the work?

PM me via Slack if you want to discuss further

https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants