-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Description
Is your feature request related to a problem? Please describe.
As of openapi-generator 7.11.0 (#19577, #19578), a jackson @JsonCreator constructor is generated for models with required properties.
When deserializing a payload that is missing required properties, jackson throws a MismatchedInputException.
This means that part of the input validation concerns, which are typically handled by Bean Validation, are now done by jackson instead.
This is not always desirable:
Frameworks may translate Bean Validation errors to a proper HTTP 400 Bad Request, while that is not necessarily done for Jackson MismatchedInputException. It is also difficult to distinguish such MismatchedInputException caused by inbound request (should map to HTTP 400) to one caused by an inbound respons (should map to HTTP 500) in a generic way.
There's also a regression causing incorrect validation errors for required properties in oneOf (#20545).
Describe the solution you'd like
A config option "generateJsonCreator" (default true) which can be set to false to disable the generation of the @JsonCreator constructor with required properties.