swagger-api / swagger-api/swagger-codegen
[JAVA] Suggestion: Add option to generate arrays with "uniqueItems" true as Sets rather than Lists
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Is there a way to generate fields declared as "array" in JSON, but with "uniqueItems": true as a Set rather than a List? JsonSchema2Pojo does this by default.
Swagger-codegen version
2.4.4
Suggest a fix/enhancement
Either change the default behavior to generate Sets automatically in this case or add an option e.g. uniqueItemsArraysAsSets that will cause the generator to create Sets in these places.
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
No file, test, or entry point is named in the issue; begin by locating the Java generator logic and templates that map uniqueItems arrays to collection types. Done means uniqueItems true arrays can be generated as Sets, either by the default behavior or a clearly defined option, with coverage for the selected 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