openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

Generating deserializers from OpenAPI Spec for kotlin models using Jackson

Open kentis opened this issue 3 years ago • 3 comments

Adds option in the kotlin-jackson model generator to generate deserializers.

By using generated deserializers instead of reflection based deserialization, we can achieve approximatly 3x speedup Resolves #13266

Attn Kotlin Technical Commity:

@jimschubert @dr4ke616 @karismann @Zomzog @andrewemery @4brunu @yutaka0m

CoAuthor: @kny78

PR checklist

  • [X] Read the contribution guidelines.
  • [X] 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.
  • [x] Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    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 example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • [X] File the PR against the correct branch: master (6.1.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • [X ] If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

kentis avatar Aug 24 '22 10:08 kentis

@jimschubert could you review this PR?

kny78 avatar Sep 02 '22 08:09 kny78

By using generated deserializers instead of reflection based deserialization, we can achieve approximatly 3x speedup

Thanks for the enhancement. Shall we make it the default? or maybe even without an option (to avoid too many option)?

In other words, would the customized deserializer potentially break anything?

wing328 avatar Sep 04 '22 09:09 wing328

Thanks for the enhancement. Shall we make it the default? or maybe even without an option (to avoid too many option)?

The Deserializer is only used if the deserializer is registered with the ObjectMapper or invoked directly. But there should probably be some documentation on how to use it.

In other words, would the customized deserializer potentially break anything? We have tested the new generated deserializer by comparing the ouitput from the current reflection-based deserializer. These two produces the same result. (JsonNode)

kny78 avatar Sep 04 '22 13:09 kny78