swagger-api / swagger-api/swagger-core
Distinguish between no default value specified and a default value `null` specified in the OpenAPI.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
Schema::getDefault() today returns a null value if no default value is specified in the OpenAPI document. The OpenAPI standard allows to explicitly specify null when a property is nullable. However this case cannot be detected because Schema:getDefault() will return null in that situation, too. An additional boolean flag Schema::hasDefaultValue() would be required.
Use case is the OpenAPI generator, where I would like to generate special code if the default value is set explicitly to null.
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 by locating Schema::getDefault() and the OpenAPI schema representation it reads. Add the requested Schema::hasDefaultValue() behavior so an omitted default is distinguishable from an explicitly specified null, allowing the OpenAPI generator to detect the explicit case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100