OpenAPITools / OpenAPITools/openapi-generator
[Bash] Enforcement of required parameters is not working when there is 1 required parameter and 0 provided parameters
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
This doesn't work for empty input parameters list, when exactly one parameter is required, e.g. client.sh someOperation. This is because above line's stdin "${operation_parameters[$qparam]}" produces one empty line, so we get associative array with default key 0 and value "". I.e. ${#operation_parameters} is equal to 1.
My suggested solution would be to change above line to:
mapfile -t parameter_values < <( { sed -e 's/'":::"'/\n/g' | sed -E '/\s*/d'; } <<<"${operation_parameters[$qparam]}")
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 at modules/openapi-generator/src/main/resources/bash/client.mustache around line 408 and reproduce the issue with client.sh someOperation when the operation has one required parameter and no supplied parameters. Verify that empty input does not create a parameter entry and that enforcement still rejects the missing required parameter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100