OpenAPITools / OpenAPITools/openapi-generator
[BUG][Java] BeanValidation patterns dont match across newlines
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
actual @Pattern(regexp = ".")
expected @Pattern(regexp = ".", flags = { Pattern.Flag.DOTALL })
openapi-generator version
latest (code check)
OpenAPI declaration file content or url
type: string
pattern: .*
Generation Details
Steps to reproduce
- use the above for a generation
- this will generate a Pattern(".*)
- if you then send a validated property with new lines against it , it will not match
Related issues/PRs
Suggest a fix
add DOT_ALL either by default or with a config flag (due to potential breaking change)
https://github.com/OpenAPITools/openapi-generator/blob/6da343a8ad1176875f27e7a4465164646574dc3d/modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache and reproduce the issue using the provided OpenAPI declaration with a Java Spring generation. Compare the generated @Pattern annotation with the expected DOTALL form. Done means multiline values match the generated Bean Validation pattern, with the breaking-change/config-flag choice addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100