OpenAPITools / OpenAPITools/openapi-generator
[REQ] Add parameter to standardize handling null types in all language
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
this is a problem that happens when a property has no default value, and is marked non-required and non-nullable
related: https://github.com/OAI/OpenAPI-Specification/discussions/2807
Describe the solution you'd like
- Add a new parameter for all language generators (e.g.
handlingStrategyForNonNullableNonRequired) - Its possible values are:
FALLBACKold behavior so we won't cause a breaking changeassumeNullableassume that it'snullableassumeRequired, assume that it'srequiredassumeDefault, assumes adefaultvalue based on the clr (e.g. in c# that would bedefault(T), in js it would beundefined)raiseErrorprevents handling this case altogether
- languages will then opt-in to handle this new parameter by specifying in the
FEATURE SETwhat of the 5 values they support (All languages will supportfallback,raiseError,assumeNullable,assumeRequiredby default, since they can be handled globally)
I can start working on the implmentation if someone can point me in the right direction
@wing328
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 implementation files or tests are named. Start by tracing how language generators declare their FEATURE SET and how non-required, non-nullable properties are handled, then read the linked OpenAPI discussion for the underlying case. Done means the proposed parameter and its five values have defined support across the relevant generators without changing the fallback behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100