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
20.63k stars 6.29k forks source link

[REQ] [JAVA] Generation should exit with error when an unsupported serialization library is chosen #18852

Open Philzen opened 1 month ago

Philzen commented 1 month ago

Is your feature request related to a problem? Please describe.

Related to #18829 – although it is documented in the library option, it would be much more helpful to users if it would fail hard.

Describe the solution you'd like

Ideally, the generator would know about this and exit with a helpful message. Less ideal, it would just throw an exception (might lead to more bug reports than it saves).

Approach

Generally, the current codebase lacks the ability to programmatically query this kind of information from one place. I've started to develop a structured enum that may could be used for this task and also simplify the existing assignment of serializationLibrary in processOpts():

https://github.com/OpenAPITools/openapi-generator/blob/1c787babadbad3f914aece0ce4b0d8e3bbfaa0e6/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java#L70-L109