Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: nullable & optional/required marks

See original GitHub issue

Can 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:open
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

raderiocommented, Dec 10, 2018

As I understand, it will be like

  "type": "object",
  "properties": {
    "counter": {
      "type": "integer",
      "nullable": true,
   "required": [

Am I correct?

MikeRalphsoncommented, Dec 10, 2018

Non-nullable and optional is the default in a schema object for properties.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found