openapi-json-schema-generator
openapi-json-schema-generator copied to clipboard
Add kotlin generator, includes schema generation and validation
Add kotlin generator
- includes schema generation and validation
thoughts on kotlin map output class constructors vs using named args
- usingnamed args is possible BUT
- kwargs would have to be passed first as Pair<String, String> varargs
- one could not type hint unions like Union[str, int] in python
- for that reason, I choose to keep using the existing java style map + list builder
- in the future one could add a flag createBuilderForMapOutputClasses and when it was false named arguments + varargs would be used like described above
- or one could auto-generate an of method for the output classes if all of their args have one type only
todo
- remove unneeded getNewInstance methods for primitive types in JsonSchema
- fix kotlin main readme types
- add 310 generation and test to CI
future work
- simplify the JsonSchemaInfo class, used named args with defaults
PR checklist
- [ ] Read the contribution guidelines.
- [ ] Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
- [ ] Run the following to build the project and update samples:
Commit all changed files. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for examplemvn clean package ./bin/generate-samples.sh ./bin/utils/export_docs_generators.sh./bin/generate-samples.sh bin/generate_samples_configs/python*For Windows users, please run the script in Git BASH.