json-schema-validator

Check differently nested properties in JSON Schema

不羁的心 提交于 2019-12-24 10:11:52
问题 Is there a way to implement the Postgres equivalent to CHECK constraint within a nested JSON Schema? Say we have data that has two properties, each of which has nested properties. How can JSON Schema make the required contents of the first object depend on the second? My real case scenario is to build a JSON schema for a GeoJSON objects, that has a geometry object (i.e. Point or Polygon, or null), and other attributes in a "properties" object. I want to alter the required properties depending

Is it possible to have JSON schema autocomplete and documentation with eclipse?

孤者浪人 提交于 2019-12-24 08:35:01
问题 I have a massive JSON setup file that I use with one of my projects. I would like to write some documentation and validation rules via a JSON schema so the edition of this file is easier for someone who's not familiar with it. I want to be able to open the json setup file in Eclipse and have autocomplete for the json properties via intellisense. I also want to see the documentation comments for any json setup property when the mouse is over it. I can't find any kind of documentation about

Postman array schema validation

Deadly 提交于 2019-12-24 01:01:46
问题 I have the problem with array json schema validation in postman. var schema = { "type": "array", "items": [{ "id": { "type":"long" }, "name": { "type":"string" }, "email": { "type":"string" } }] }; pm.test('Response schema type nodes verification', function() { pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true; }); And the response body is: [ { "id": 1, "name": "test1", "email": "a@a.com" }, { "id": 2, "name": "test2", "email": "a@a.com" }, . . . ] I have always passed result.

What is the logical relationship between keyword in a json schema?

我的梦境 提交于 2019-12-13 06:52:27
问题 According to the specification (http://json-schema.org/schema) there is no mutual exclusion among schema keywords. For example I could create the following schema: { "properties" : { "foo" : {"type" : "string"} } "items" : [ {"type" : "integer" }, {"type" : "number" } ] } Would this schema validate against both objects and arrays? If so it would imply an "OR" relationship between keyword. But if we consider the following schema: { "anyOf" : [ { "type" : "string",}, { "type" : "integer"} ]

How to remove dependencies of order in Json schema in case of Array of objects

99封情书 提交于 2019-12-13 06:27:50
问题 I have one Json schema template, which contains array of objects. And I need to verify Json input with that template. But I want this should not dependent on order for object in array. And below we have array of 3 different object in template i.e. abs, endpoint and dispatch. I want to remove dependency of order from here. I can provide ant order of items in Json input schema. It should not dependent on template. I am using 'ajv' node js template to validate the Json input with template data.

Is there any way to validate events payload schema while using Azure Event Hub API?

主宰稳场 提交于 2019-12-11 10:27:51
问题 I must send events to Azure Event Hub directly using http protocol. How can I validate payload json schema of the event in Azure (same as validating in a web api) before the event ingestion? 来源: https://stackoverflow.com/questions/54789404/is-there-any-way-to-validate-events-payload-schema-while-using-azure-event-hub-a

Mongo Json Schema Validator AnyOf not working

泪湿孤枕 提交于 2019-12-11 04:05:21
问题 I have created the a collection with the below validation: { $jsonSchema: { bsonType: 'object', additionalProperties: false, properties: { _id: { bsonType: 'objectId' }, test: { bsonType: 'string' } }, anyOf: [ { bsonType: 'object', properties: { test1: { bsonType: 'string' } }, additionalProperties: false }, { bsonType: 'object', properties: { test2: { bsonType: 'string' } }, additionalProperties: false } ] } } The Validation Action was set to Error and Validation Level to Moderate. When I

tv4.validate always return true. Even if my schema not valid i.e.: var == “dummy”

≡放荡痞女 提交于 2019-12-11 02:00:33
问题 tv4.validate will always return true. No matter if schema is valid JSON or even just dummy string. I browse stackoverflow for related issues and banUnknownProperties does not help me As i told i even tried to change schema variable to "dummy" and tv4 still does not find error. That`s my first post on stackoverflow. Sorry if my question not clear. Valid response will be as following [ { "dayOfWeek": "sunday", "openTime": "10:00:00", "closeTime": "14:00:00" }, { "dayOfWeek": "monday", "openTime

How do I do a nested list (array) of schema references in json schema

只愿长相守 提交于 2019-12-10 22:18:05
问题 I am trying to build a schema which has a list of items that I want to have an enforced schema. Basically here is the data I want to validate against the schema: data = { "VIN" : "123", "timestamp" : "xxxx", "model" : "jeep", "inspections": [ { "door_badge" : { "expected": "yes", "image": "/image/path/here", "state": 1 }, }, { "rear_badge" : { "expected" : "yes", "image" : "/image/path/here", "state": 1 } } ], } And my schema mapping as is such but seem to be getting errors when trying to

How do I do a nested list (array) of schema references in json schema that isn't a dictionary

别等时光非礼了梦想. 提交于 2019-12-10 15:06:51
问题 So I have a similiar question (see: How do I do a nested list (array) of schema references in json schema), but now my structure is changed a little and can't seem to get it to validate. data = { 'VIN': '1234567', 'Vehicle color': blue, 'inspections': [ {'expected': 'MVA', 'found': 0.0, 'inspection': 'Fascia', 'location': 'rear_left', 'state': None}, {'expected': 'MVA', 'found': 0.0, 'inspection': 'Fascia', 'location': 'rear_right', 'state': None}, {'expected': 'UNKNOWN', 'found': 'CPW7',