swagger-api / swagger-api/swagger-codegen
Java Clients: Support Optional<T> on model classes when a field is not required
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I think (similar to the swift client) that is would be nice, if the generated clients had an option to enable the use of the Optional<T> type on model fields that are not required.
This should both include and option to use
com.google.common.base.Optionaljava.util.Optional<T>
Supporting guava is probably needed for all those people that are not using java8 for whatever reason (for instance Android projects).
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 specific files or tests are named. Start by locating the Java client generation templates and option handling, then compare the Swift client's analogous support mentioned in the issue; done means optional non-required model fields can be generated with either Guava Optional or java.util.Optional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100