logo
down
shadow

`additionalProperties` rule in JSON schema is not applied to nested level properties


`additionalProperties` rule in JSON schema is not applied to nested level properties

Content Index :

`additionalProperties` rule in JSON schema is not applied to nested level properties
Tag : json , By : CrimsonGore
Date : November 29 2020, 04:01 AM

With these it helps
Is the additionalProperties JSON schema definition only applies to top-level fields and not to any nested level fields?
{
  "type": "object",
  "properties": {
    "metadata": {
      "type": "object",
      "properties": {
        "a": {
          "type": "string"
        },
        "b": {
          "type": "string"
        },
        "c": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "street_type": {
      "type": "string",
      "enum": [
        "Street",
        "Avenue",
        "Boulevard"
      ]
    }
  }
}
{
  a: {
    b: {
      c: {
        d: 42
      }
    }
  }
}
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "a": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "b": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "c": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "d": {
                  "const": 42
                }
              }
            }
          }
        }
      }
    }
  }
}

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

What is the difference between additionalItems and additionalProperties in JSON Schema?


Tag : javascript , By : Vijayant Singh
Date : March 29 2020, 07:55 AM
like below fixes the issue As it is explained in the docs, additionalProperties is a validation keyword for objects/documents, and additionalItems is a validation keyword for arrays.

Reuse properties from a remote JSON schema, at the same level of the original schema


Tag : javascript , By : Umang
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I have a remote schema "person.json", saved on another file. , You want to use the allOf keyword, combined with $ref:
{
    "id": "/schemas/man.json",
    "allOf": [{"$ref": "person.json"}],
    ...
}

How to use additionalProperties with allOf in JSON schema?


Tag : json , By : eastcoastj
Date : March 29 2020, 07:55 AM
I wish this help you Your schema could be expanded this way:
allof: It must validate independently against two schemas:

Json schema oneOf with additionalProperties draft-04


Tag : json , By : mansoor
Date : March 29 2020, 07:55 AM
around this issue The oneOf, anyOf, ... keywords cannot be used for referencing other definitions. They do work for required. The solution is to declare all properties and only require the properties that are needed in the context. My example would become the following:
"assertion": {
  "type": "object",
  "additionalProperties": false,
  "oneOf": [
    {
      "required": [
        "operator"
      ]
    },
    {
      "required": [
        "primitive"
      ]
    }
  ],
  "properties": {
    "operator": {
      "$ref": "#/definitions/operator"
    },
    "primitive": {
      "$ref": "#/definitions/primitive"
    },
    "preference": {
      "type": "integer",
      "minimum": 0,
      "exclusiveMinimum": true
    },
    "usage": {
      "enum": [
        "required",
        "rejected",
        "optional",
        "observed",
        "ignored"
      ]
    }
  }
}

In JSON Schema how are conflicting 'additionalProperties' to be parsed?


Tag : json , By : platformNomad
Date : March 29 2020, 07:55 AM
seems to work fine In JSON Schema if we have "additionalProperties":false at the root level and "additionalProperties":true nested how are we to resolve this putative "conflict" , They don't override. Their scope is limited to the JSON schema level.
Related Posts Related QUESTIONS :
  • Getting _jsonparsefailure with valid json in logstash
  • How to send Map as String in POST request in flutter?
  • Difficulty fetching json data from API using Angular
  • Reading JSON data for my select query in SQL Server
  • AWS CloudFormation Template (JSON) to Create EC2 - Unexpected Error
  • How to concat multiple fields to same line with jq
  • Issue sending POST request from Swift
  • Storing JSON in BigQuery
  • How to get the value of a key in a JSON?
  • How to validate JSON input in Go
  • Extracting specific and latest data from http webserver using golang
  • Incorrect type. Expected "object"
  • json_to_record with embedded encoded json in PostgreSQL >= 10
  • Nested json extract from powershell
  • Parsing Json using Golang
  • Type 'number' is not assignable to type 'string'. How to cast number to string
  • kubectl - format the resource quota values in json format
  • Initializing and inserting nested JSON data in Golang?
  • Open JSON files in PhpStorm built-in web server
  • Extract Badge ID from JSON in .gitlab-ci.yml
  • Sharing Json Schema files among projects with versioning
  • Export Json data to an excel file using Angular 4
  • Return an empty array instead of null with golang for json return with gin
  • can Kafka connect value conveter (JSONConverter) can be used to convert GPB?
  • read json and access multiple keys
  • Spark How to get number of Keys changed in two JSONS in Scala?
  • Break JSON in pager "less"
  • How to filter Map in Flutter?
  • Convert hashmap to simple object in Groovy
  • Not extracting json properly using json4s
  • How do I display JSON data in my tableView when objects have the same value?
  • Where I can parse IoT data in Azure so I can afterwards save it to SQL DB
  • How to unmarshal this json string
  • What's wrong with my JSON?
  • JSON parsing problem in BlackBerry
  • GWT: How can I use JsonpRequestBuilder to handle a Json response of a list
  • JSON feed to Java Object
  • json character encoding problem
  • JSON Loading Speed Optimization: Use online API vs. create my own API based on that?
  • How can I access some JSON documents from my AWS lambda function?
  • How to extract multiple correlating variables from a JSon
  • Schema/Resolve for nested objects graphql/mongoose
  • Dynamics 365 opportunity EntityType processid and stagename error
  • How to convert dataframe output to json format and then Normalize the data?
  • In Angular, how do I avoid a "Property 'json' does not exist on type 'Object'" error?
  • Python giving vague error when trying to parse JSON object
  • Invalid JSON literal: xxx when calling ASMX service from Angular8
  • How to write the data converted from json to csv without skipping the rows
  • Unpacking JSON Into Flat Format
  • TypeError: items is undefined while reading a json using fetch in reactjs
  • How to insert date to the web path api
  • schema validation get value from sum of another value of json
  • Deleting a field in nested objects in JQ
  • Get multiple JSON keypair values within a JSON object only if a specific keypair value matches iterable
  • parse contents from returned json to el-dropdown-item
  • Replace content by key in JSON
  • JSON parsing using String Condition with JMESPATH
  • Only Output Rule Alerts to Suricata EVE
  • How to unmarshal a json string with a hyphen in key to a struct?
  • How can I aggregate sub-values into arrays with jq?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com