kokuwaio/micronaut-openapi-codegen

Optional<String> not working with @javax.validation.constraints.Pattern

DominikBasnerSotec opened this issue · 1 comments

When using a parameter which schema has a pattern inside like:

post:
   parameters:     
        - in: query
          name: version
          required: false
          schema:
            type: string
            minLength: 1
            pattern: '^\d+\.\d+\.\d+$'

the tool resolves it to:

			@javax.validation.constraints.Size(min = 1)
			@javax.annotation.Nonnull
			@io.micronaut.http.annotation.QueryValue(value = "version")
			java.util.Optional<java.lang.String> version

which itself leads to the following exception when called:
HV000030: No validator could be found for constraint 'javax.validation.constraints.Pattern' validating type 'java.util.Optional<java.lang.String>'. Check configuration for 'findServices.versionOptional

even when the tool behaves as expected, the combination of Optional and Pattern don't seem to work

Cannot reproduce with micronaut-validator (see commit 28c0cf8).

IMHO: there is an issue with your hibernate validator setup.