swagger-api / swagger-api/swagger-codegen
Code/Architecture needs documentation
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
As a Java developer trying to contribute some code, I must say that I find it quite hard to orientate myself in the code base.
The README.md has mainly information about the actual usage, and CONTRIBUTING.md has some generic advice.
What I'm missing is a general overview how the code generation (and the configuration) works (the non-language-specific parts). It also doesn't help that most classes and methods don't have any Javadoc, which makes finding out what they are for quite hard.
Could the people who understand how it works please invest some time to write a general overview and Javadocs for the classes in the main package (io.swager.codegen)?
For the current example: I wanted to finally fix #1255 (which I opened myself back in september). I figured out I would add fields modelNamePrefix and modelNameSuffix in DefaultCodeGen, and use them in toModelName (and maybe also toModelFileName?). So far, so easy.
The hard part now is figuring out how to get those values into this class from the maven plugin or the CLI.
It looks like some parameters are passed via additionalProperties, others are passed via dedicated setters from outside. To fill additionalProperties from the command line, there is the --additionalProperties option defined in io.swagger.codegen.cmd.Generate, but the Maven-Plugin seems to not support that. Also, CLI seems to use the CodegenConfigurator, which then creates a ClientOptInput, which is passed to a DefaultGenerator. The ClientOptInput contains both a ClientOpts object and a CodegenConfig object, and the additional options are passed from the former into the latter. Though in the CodegenMojo, the additional properties are directly set in the CodegenConfig object (but only some special-cased ones and those which are declared by the CodegenConfig implementation as cliOption and passed to the maven-plugin as configOptions).
Sorry, I can't see any real sense in all this. Can someone help me figure this out?
(If someone explains it to me, I can also help to document it, or refactor it so it gets clearer.)
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 README.md and CONTRIBUTING.md, then trace the Java flow through io.swagger.codegen.cmd.Generate, CodegenConfigurator, ClientOptInput, DefaultGenerator, and CodegenMojo. Document the non-language-specific generation and configuration flow, and add Javadocs for the main package classes; done means a newcomer can understand how CLI and Maven-plugin options reach code generation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100