Question: nullable & optional/required marks
See original GitHub issueCan we represent in specification that a field is non-nullable & optional?
this mean, or we send a data for the field, or just do not send the field in request, null
is not allowed.
{"foo": "bar", "baz": true}
is allowed
{"baz": true}
is allowed, because is optional
{"foo": null, "baz": true}
is NOT allowed, because is non-nullable
Basically null
has the meaning of “this property existed before, and I want to nullify its value”. If there’s no value, or the value needs not change (for requests, for example), it just shouldn’t be sent.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Should Optional.ofNullable() be used for null check?
Using Optional as a return value avoids the problem of the caller accidentally misusing the sentinel value as the real return value.
Read more >and ??= operators - null-coalescing operators - Microsoft Learn
The null-coalescing operator ?? returns the value of its left-hand operand if it isn't null ; otherwise, it evaluates the right-hand operand ...
Read more >Optional chaining (?.) - JavaScript - MDN Web Docs - Mozilla
The optional chaining (?.) operator accesses an object's property or calls a function. If the object accessed or function called is ...
Read more >Optional vs Nullable In Typescript/Angular - Upmostly
Again, the most important thing about all of this is divorcing the idea that the question mark operator works the same as it...
Read more >Defining Optional Properties and Nullable Values in RAML
3? In that case, the property is optional as it has a required: false facet. However, the question mark (?) becomes a part...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As I understand, it will be like
Am I correct?
Non-nullable and optional is the default in a schema object for properties.