OpenAPITools / OpenAPITools/openapi-generator
[REQ] Reduce the elements in the generated example arrays
Open
Nobody has claimed this yet.
Enhancement: Feature
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
For a request body like:
Personalization:
required:
- to
properties:
to:
type: array
minItems: 1
maxItems: 1000
items:
$ref: '#/components/schemas/EmailAddress'
cc:
type: array
maxItems: 1000
items:
$ref: '#/components/schemas/EmailAddress'
bcc:
type: array
maxItems: 1000
items:
$ref: '#/components/schemas/EmailAddress'
The generated curl example includes five elements in each array. It is kind of unwieldy, using the max of minItems or 1 might look better
curl -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
"https://www.example.com" \
-d '{
"personalizations" : [ {
"cc" : [ {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
} ],
"bcc" : [ {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
} ],
"to" : [ {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
}, {
"name" : "name",
"email" : "email"
} ]
} ] }
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
The issue names no files, tests, or entry points. Trace the request-body example generation path for OpenAPI array schemas, then run the relevant generator tests or reproduce the curl example; done means generated arrays use the requested smaller element count without affecting other examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100