OpenAPITools / OpenAPITools/openapi-generator
[BUG][JAVA] Enum array are no longer validated
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
For enum array, the use of validation field doesn't add the validation to the java class.
For example, this
closing_days:
type: array
minItems: 1
items:
type: string
enum: [ MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY ]
Does not add a validation @Size(min = 1) annotation with useBeanValidation.
In fact, this looks like since https://github.com/OpenAPITools/openapi-generator/pull/18658, any validation is skipped for enums.
openapi-generator version
7.8.0
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/pull/18658
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
Read the OpenAPI schema example and related PR 18658 first, focusing on how useBeanValidation handles enum arrays. Confirm that the generated Java class includes @Size(min = 1) for minItems while retaining enum handling, then verify the behavior with the reported 7.8.0 case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- backend-api-design, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100