swagger-api / swagger-api/swagger-codegen
[Java] How can I instruct client codegen to not use tags?
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am using Java client codegen to generate client code. I don't want it to generate an API class for each tag present in my operations. Is there anyway to combine or instruct codegen to ignore tags?
The only workaround I have managed to come up with is to do the below (in my build.gradle):
def input = new CodegenConfigurator(
inputSpec: file("${rootDir}/api.yml").absolutePath,
outputDir: outputDir,
lang: 'java',
library: 'resttemplate',
additionalProperties: [
apiPackage: "${basePackage}.client".toString(),
modelPackage: "${basePackage}.client.model".toString(),
interfaceOnly: 'true',
sourceFolder: 'swagger/java/main',
jackson: 'true',
java8: 'true',
dateLibrary: 'java8'
],
systemProperties: [
apis: '',
apiDocs: 'false',
modelDocs: 'false',
apiTests: 'false',
modelTests: 'false',
models: ''
]
).setVerbose(true).toClientOptInput()
input.swagger.paths.each {key, value ->
value.operations.each {
it.tags = ['SingleClient']
}
}
new DefaultGenerator().opts(input).generate()
It seems wrong to be modifying the tags. Any other alternatives apart from me extending the DefaultGenerator itself?
Swagger-codegen version
2.4.14
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the CodegenConfigurator and DefaultGenerator flow shown in build.gradle, then inspect how operation tags become Java API classes in swagger-codegen 2.4.14. Determine whether an existing configuration entry point can suppress or combine tag-based classes; done means a supported option or clearly scoped implementation path verified against the reported setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100