OpenAPITools / OpenAPITools/openapi-generator
[BUG] Options are not parsed correctly
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 full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- 4.1.2-SNAPSHOT
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
From #japanese slack channel:
https://openapi-generator.slack.com/archives/CLTHWFBEJ/p1566966541003500
--type-mappings object=Dict[str, Any],string=String
The parameter above is not parsed correctly.
Expect:
object=Dict[str, Any]string=String
Actual:
object=Dict[strAny]string=String
It's due to the splitCommaSeparatedList implementation that just split by comma:
openapi-generator version
4.1.2-SNAPSHOT
Command line used for generation
openapi-generator \
generate \
--input-spec openapi.yaml \
--generator-name python \
--output /local/out \
--type-mappings object=Dict[str, Any]
Suggest a fix
- Improve the parsing implementation to respect symbols (
[],<>) - or use parsing library that satisfy the requirement
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 in modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OptionUtils.java at the linked splitCommaSeparatedList implementation. Reproduce the issue with the documented openapi-generator command and type mapping, then verify that values containing brackets or angle brackets remain intact while separate mappings are still parsed separately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100