Questions tagged [jsonschema]

A JSON Schema is a JSON document (an object) which defines constraints on what other JSON documents (the instances) should obey; it can also be used to interpret instances so as to provide links to external resources (hyper schema).

JSON (JavaScript Object Notation) Schema defines the media type application/schema+json, a JSON based format for defining the structure of JSON data.

JSON Schema provides a contract for what JSON data is required for a given application and how to interact with it. JSON Schema is intended to define validation, documentation, hyperlink navigation, and interaction control of JSON data.

References:

For the latest Internet Draft documents, see the specification section of the website.

3348 questions
1
vote
1 answer

Can I declare a field in JSON Schema as “JSON Schema”?

A project of mine accepts “plugins”. These plugins need to provide a special JSON file which contains some meta information and also describes event objects with JSON Schema. For example: { "name": "My component", "description": "My super…
lxg
  • 12,375
  • 12
  • 51
  • 73
1
vote
2 answers

How to make some fields optional in existing JSON shema

I would like to use single JSON schema for both creating and updating (patching) a record in my app. The problem happens with required property, which i don't know how to change for purposes of patching. I should allow partial updates on the…
Kristijan
  • 323
  • 6
  • 11
1
vote
1 answer

Express that, for a given property value, a property with the same name should exist using json schema?

I'm trying to validate json files which have an element that has a property which contains a value that should exist in another part of the json. I'm using jsonschema Draft 07. This is a simple little example that shows the scenario I'm trying to…
John Pajak
  • 13
  • 2
1
vote
1 answer

How to generate classes using jsonschema2pojo that include a class called "System"?

I am attempting to generate Java classes from a third party JSON schema using jsonschema2pojo, so I need to go with the names of classes. One of the classes is called System. As a result, for all classes other than that class, there is an error in…
John
  • 10,837
  • 17
  • 78
  • 141
1
vote
1 answer

Extract part of the json data using a schema

I am looking for a way to extract part of a json doc using a json schema. So given a large and complicated json doc, sub parts of the data can be extracted using json schema. This is different to validation. The concept would be to take part of the…
Nick Wood
  • 21
  • 1
1
vote
1 answer

required and additionalProperties is not working for jsonschema module Python

I have following code : from jsonschema import validate schema_data = { "type" : "object", "properties" : { "price" : {"type" : "number"}, "name" : {"type" : "string"}, "additional" : {"type" : "number"}, }, …
Harsha Biyani
  • 7,049
  • 9
  • 37
  • 61
1
vote
0 answers

Fast Java JSON Schema Validator for large files

I need to validate large JSON files (potentially in GB's) against JSON schemas in java. Any pointers on the library that I could use to do this in the SAX way(as opposed to the DOM way) and ways to keep it generic?
1
vote
1 answer

When using JSON Schema for validation, it is not recursively validate child entities?

When using the following schema { "$schema": "http://json-schema.org/schema#", "definitions":{ "entity": { "type": "object", "properties": { "parent": {"type": ["null","string"]}, …
Ryan Lynar
  • 13
  • 2
1
vote
0 answers

PHP array and JSON schema

Many times I have had this scenario in php where I have a data structure but it is hard to work with because PHP doc cannot handle it. "John", "lastName" => "doe", "age" => 26, …
santiago arizti
  • 4,175
  • 3
  • 37
  • 50
1
vote
1 answer

JSON conditional schema

I have the following json schema and need to add few conditions as follows. if user_type == "human" then environment should be "A1 OR A2 OR A3" if user_type == "batch" then environment should be "B1 OR B2 OR B3" How should i add that…
Tharanga Abeyseela
  • 3,255
  • 4
  • 33
  • 45
1
vote
1 answer

Using jsonPath property in json schema returns a random string instead of the value in the given path

Continuing from my previous unresolved issue, I am using json-schema-faker and json-server and i am currently trying to reuse some data from my json schema. I have found the property: jsonPath from this page in Github which explains exactly what I…
Marialena
  • 817
  • 8
  • 31
1
vote
1 answer

pkg_resources.DistributionNotFound: 'jsonschema'

unable to get "intel-nauta" running as its throwing this error : pkg_resources.DistributionNotFound: The 'jsonschema' distribution was not found and is required by the application [19160] Failed to execute script main. python 3.0 while pip…
1
vote
2 answers

Generate json schema from pojo in java - custom date type

I am using https://github.com/mbknor/mbknor-jackson-jsonSchema for generating json schema but when my object contains LocalDate, LocalDate will look like this: "LocalDate" : { "type" : "object", "additionalProperties" : false, …
Druudik
  • 955
  • 1
  • 10
  • 32
1
vote
2 answers

Have one property define the types in another array property, using JSON Schema?

Given this example JSON: { "type": "number", "values": [ 34, 42, 99 ] } Is it possible to define JSON Schema that makes sure that the contents of the values array are of the type specified in another property (in this example type)? Above…
Diego Barros
  • 2,071
  • 2
  • 33
  • 45
1
vote
1 answer

Json Schema Form Condition show/hide based on enum selected item

I have an angular project in which I'm using JSON Schema Form (angular6-json-schema-form) to build forms in JSON schema. The json schema form specification allows the use of a condition switch to selectively show/hide elements based on the value of…
Scott B
  • 38,833
  • 65
  • 160
  • 266