question-mark
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.

Don't include properties that are not required in the value

See original GitHub issue

With this schema:

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "age": {
      "type": "integer"
    }
  }
}

If user doesn’t put any data in, the output value should be {}. None of the properties are required.

If a property is required, then it makes sense to fill in the value for required property with some default value:

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "age": {
      "type": "integer"
    }
  },
  "required": ["age"]
}

This should output {"age": 0} since "age" is required and empty object will not conform to the schema

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
centromerecommented, Aug 6, 2016

Any update on this?

0reactions
bozkurt30commented, Dec 1, 2022

Hello; For C# (.net 6 ), when you correct your bool value as follows, the false value swagger also works. public bool? IsBlock { get; set; } = false; “worked after adding a question mark”

good work

Read more comments on GitHub >

github_iconTop Results From Across the Web

Don't fail if @Value is not supplied in properties?
In general it is a good practice to fail on unknown properties (they are properties, because your application needs them to function), or...
Read more >
How to ignore properties with System.Text.Json | Microsoft Learn
To ignore individual properties, use the [JsonIgnore] attribute. You can specify conditional exclusion by setting the [JsonIgnore] attribute's ...
Read more >
object — Understanding JSON Schema 2020-12 documentation
By default, the properties defined by the properties keyword are not required. However, one can provide a list of required properties using the...
Read more >
Create and edit properties - Knowledge Base - HubSpot
If you want to view or update values for properties, learn how to edit property values on a ... This is not required...
Read more >
Title 57. Real Estate Chapter 1 Conveyances - Utah Legislature
(2) "Document" means every instrument in writing, including every conveyance, affecting, ... 57-1-2 Words of inheritance not required to pass fee.
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found