DESCRIPTION
It has been noted before, 108278124 that in some languages and frameworks it is not desirable to automatically include regular expression delimiters in a pattern.
I'm using some custom mustache files based on openapi-generator to generate classes for a kotlin-spring application : beanValidationCore.mustache
This now generates jakarta validation annotations like this:
@Pattern(regexp="/^[0-9a-zA-Z]{0,5}$/")
This does not work, as it's now matching the forward slash '/'.
PROPOSED SOLUTION
My suggestion is to override toRegularExpression in the AbstractKotlinCodegen similar to what has been done in AbstractJavaCodegen, so that it does not create extra regular expression delimiters.
It's easier to add this in a mustache/handlebar files, than to remove it.
DESCRIPTION It has been noted before, 10827 8124 that in some languages and frameworks it is not desirable to automatically include regular expression delimiters in a pattern.
I'm using some custom mustache files based on openapi-generator to generate classes for a kotlin-spring application : beanValidationCore.mustache
This now generates jakarta validation annotations like this:
This does not work, as it's now matching the forward slash '/'.
PROPOSED SOLUTION My suggestion is to override
toRegularExpression
in the AbstractKotlinCodegen similar to what has been done in AbstractJavaCodegen, so that it does not create extra regular expression delimiters. It's easier to add this in a mustache/handlebar files, than to remove it.