OpenAPITools / OpenAPITools/openapi-generator
[REQ] Custom Extension for primitive List
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
I have a use case where I want to generate custom annotations for a List of primitive List like the example I have described.
This sample code spec should generate a Java code like below
`{
"type": "object",
"properties": {
"card_numbers": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
}
}
}`
Java code:
`public List<@Min(1) String> getItems() {
return items;
}`
I would like to add a custom validation for the values inside the annotation. like this
`{
"type": "object",
"properties": {
"card_numbers": {
"type": "array",
"items": {
"type": "string",
"cutomValidation": 1
}
}
}
}`
Java code:
`public List<@CutomValidation(1) String> getItems() {
return items;
}`
I can see the annotations for primitives are supported like this for the List of primitives from this change PR:17165 but the extension is not allowed for customization.
Describe the solution you'd like
If the primitive List model is been driven through mustache files like for other fields customisation is possible.
Describe alternatives you've considered
NA
Additional context
NA
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
Review change PR #17165 and trace how primitive List annotations are generated. Determine where custom extensions would need to flow through the generator, then verify that the requested extension produces the custom annotation on the primitive element and preserves existing primitive-list behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100