OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.83k stars 6.58k forks source link

[BUG] No way to import mappings for additionalModelTypeAnnotations #9894

Open saksham-spotnana opened 3 years ago

saksham-spotnana commented 3 years ago

Generally these annotations would require mappings to be imported, which is not currently happening with additionalModelTypeAnnotations option, leading to the generated code not compiling.

borsch commented 3 years ago

Hi @saksham-spotnana could you please provide actual and expected result or some small project which will better explain yours request

languitar commented 3 years ago

Here's an example based on the official samples contained in this repo: https://github.com/languitar/openapi-generator/commit/f6baaa60ae197bf18b4ea9c1c7b0d072bf869166

When trying to compile the jaxrs-spec server generated with the added option, things break, because @RegisterForReflection is not imported and there's no option to do so.

borsch commented 3 years ago

@saksham-spotnana @languitar you have to specify full annotation path(including package). check this example https://github.com/OpenAPITools/openapi-generator/blob/60dcf8613f6b75b606757c4a991fe018ad10ee99/bin/configs/spring-mvc.yaml