When using a Constraint (e.g. size) on a nullable element, you will get the following exception
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Size' validating type 'org.openapitools.jackson.nullable.JsonNullable<java.lang.String>'. Check configuration for 'data[0].message'
since there is no Validator for JsonNullable supporting the javax.validation.constraints.Size constraint.
We're currently testing a solution for this, declaring the necessary validators via META-INF/services. Since the JsonNullable is defined in jackson-databind-nullable i would suggest to include appropriate validators (including size and others) also in the jackson-databind-nullable module and expose them via the META-INF/services/javax.validation.ConstraintValidator to automatically support bean validation generated by the openapi-generator.
Before submitting a PR, i'd like to discuss the following questions:
-> is this module the right place for the validators (we would be adding a dependency on the javax.validation api, but without validators for json nullable you cannot use constraints in your api definition together with nullable)
-> which constraints do we need to support with validators (i.e. which constraints are currently supported by the openapi-java-generators)
When using a Constraint (e.g. size) on a nullable element, you will get the following exception
since there is no Validator for JsonNullable supporting the
javax.validation.constraints.Sizeconstraint.We're currently testing a solution for this, declaring the necessary validators via
META-INF/services. Since the JsonNullable is defined in jackson-databind-nullable i would suggest to include appropriate validators (including size and others) also in the jackson-databind-nullable module and expose them via theMETA-INF/services/javax.validation.ConstraintValidatorto automatically support bean validation generated by the openapi-generator.Before submitting a PR, i'd like to discuss the following questions:
-> is this module the right place for the validators (we would be adding a dependency on the javax.validation api, but without validators for json nullable you cannot use constraints in your api definition together with nullable)
-> which constraints do we need to support with validators (i.e. which constraints are currently supported by the openapi-java-generators)