-
Notifications
You must be signed in to change notification settings - Fork 6k
Guidelines for Contribution
- Search the open issue to ensure no one else has reported something similar and no one is actively working on similar proposed change.
- If no one has suggested something similar, open an "issue" with your suggestion to gather feedback from the community.
All the code generators can be found in modules/swagger-codegen/src/main/java/io/swagger/codegen/languages
All the templates (mustache) can be found in modules/swagger-codegen/src/main/resources.
For a list of variables available in the template, please refer to this page
Code change should conform to the programming style guide of the respective langauages:
- C#: https://msdn.microsoft.com/en-us/library/vstudio/ff926074.aspx
- Java: https://google.github.io/styleguide/javaguide.html
- ObjC: https://github.com/NYTimes/objective-c-style-guide
- PHP: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
- Python: https://www.python.org/dev/peps/pep-0008/
- Ruby: https://github.com/bbatsov/ruby-style-guide
For other langauges, feel free to suggest.
You may find the current code base not 100% conform to the coding style and we welcome contributions to fix those.
To add test cases (optional) covering the change in the code generator, please refer to modules/swagger-codegen/src/test/java/io/swagger/codegen
To test the templates, please perform the following:
- Update the Petstore sample by running the shell script under
bin
folder. For example, run./bin/ruby-petstore.sh
to update the Ruby PetStore API client undersamples/client/petstore/ruby
- Run the tests in the sample folder, e.g. in
samples/client/petstore/ruby
, runmvn integration-test -rf :RubyPetstoreClientTests
.
To start the CI tests, run mvn verify -Psamples
- Smaller change are easier for review
- [Optional] For bug fixes, provide a Swagger spec to repeat the issue so that the reviewer can use it to confirm the fix
- Add test case(s) to cover the change
- Document the fix in the code to make the code more readable
- Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests)
would suggest when compiling to use flag to ignore tests. The tests requires extra dependencies and the compilation might fail due to that.