jsonschema

JSON schema: referencing a local child schema

有些话、适合烂在心里 提交于 2019-12-08 08:17:39
问题 I want to reference a child schema in a parent json schema. Here is the child schema named child.json { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Child", "description": "Child schema", "type": "object", "properties": { "name": {"type": "string"}, "age": {"type": "integer"} }} and here is the parent schema named parent.json and all the two files are in the same folder. I want to refer to the child schema and i do like this: { "$schema": "http://json-schema.org/draft-04

Is this correct JSONSchema/Json for the XSD?

吃可爱长大的小学妹 提交于 2019-12-08 07:04:54
问题 The objective is to convert an XSD schema to JSON Schema. I am first trying to XSD to JSON and then see if i can fix the JSON to become JSON Schema.All this procedure is because right now i don't know a direct way of converting XSD to JSON Schema. Consider the following fragment for now. i have the following fragment of XSD <attributeGroup name="SimpleObjectAttributeGroup"> <attribute ref="s:id"/> <attribute ref="s:metadata"/> <attribute ref="s:linkMetadata"/> </attributeGroup> The

XOR logic in JSON schema for a list of boolean items

坚强是说给别人听的谎言 提交于 2019-12-08 05:57:48
问题 I faced a problem with validating a list of boolean values. My input is: [true,true,false] and it should not verify this because only lists with one and only one true value, should be true. At the moment my schema does a sort of inclusive OR by accepting one or more true values, but not all: { "type": "array", "items": { "$ref": "#/definitions/_items" }, "$ref": "#/definitions/xor", "definitions": { "xor": { "oneOf": [ { "$ref": "#/definitions/or" }, { "$ref": "#/definitions/and" } ] }, "

Using jsonschema to validate that a key has a unique value within an array of objects?

感情迁移 提交于 2019-12-08 03:00:00
问题 How do I validate JSON, with jsonschema, that within an array of objects, a specific key in each object must be unique? For example, validating the uniqueness of each Name k-v pair should fail: "test_array": [ { "Name": "name1", "Description": "unique_desc_1" }, { "Name": "name1", "Description": "unique_desc_2" } ] Using uniqueItems on test_array won't work because of the unique Description keys. 回答1: I found the alternative method of using a schema that allows arbitrary properties. The only

Parsing JSON data using Apache Kafka Streaming

点点圈 提交于 2019-12-08 02:08:28
问题 I had a scenario to read the JSON data from my Kafka topic, and by making use of Kafka 0.11 version I need to write Java code for streaming the JSON data present in the Kafka topic.My input is a Json Data containing arrays of Dictionaries. Now my requirement is to get the "text" field, key in dictionary contained in array from the json data and pass all those text tweets to another topic through Kafka Streaming. I wrote code till here. Please help me to parse the data. Java code for streaming

JSON schema validator in Scala

孤者浪人 提交于 2019-12-07 14:16:22
问题 I need to validate the schema of certain JSON input I receive. I am not clear about how to go about the whole thing. But this is what I have gathered so far : I need to prepare a schema for all sorts of input using something like http://json-schema.org/implementations.html Then I need a validator like https://github.com/fge/json-schema-validator I need to give the json input to and the schema to the validator and get the result. However my question is that I need to use a jar which I can

render jsonschema as a form with django-jsonschema-form or django-schemulator

拥有回忆 提交于 2019-12-07 13:01:05
问题 Pieces of JSON Schema are easily used with frontend JavaScript libraries like Angular, React and Alpaca to create an html form with validation. This should also work with a Python solution django-jsonschema-form or django-schemulator but I am new to Django and having a lot of trouble working it out.. Here is a screenshot from the video from AlpacaJS which communicates easily what this is supposed to achieve: I have done some testing with the two libraries above, and the former seems much

Use object property keys as enum in JSON schema

坚强是说给别人听的谎言 提交于 2019-12-07 11:14:09
问题 I'm trying to validate a JSON file using JSON Schema, in order to find cases of "broken references". Essentially my file consists of items and groups, with each item belonging to a single group referenced by the groups property key, like so: { "items": { "banana": { "name": "Banana", "group": "fruits" }, "apple": { "name": "Apple", "group": "fruits" }, "carrot": { "name": "Carrot", "group": "vegetables" }, "potato": { "name": "Potato", "group": "vegetables" }, "cheese": { "name": "Cheese",

Enforce object non emptyness using json schema

依然范特西╮ 提交于 2019-12-07 01:43:59
问题 We can enforce empty attribute of type object as follows: { "description": "voice mail record", "type": "object", "additionalProperties": false, "properties": {} } as explained here. Now I want to validate attribute which is of object type, dont have any predefined properties can have properties of type string or numeric should not be empty Enforcing non-emptyness (point 4) is what I am unable to guess. This is somewhat opposite of enforcing emptyness as in above example. My current json

Validate JSON schema compliance with Jackson against an external schema file

你说的曾经没有我的故事 提交于 2019-12-07 01:29:08
问题 I would like to use the Jackson library (https://github.com/FasterXML/jackson) to deal with JSON files in Java, which are described by a JSON schema file. Now, I would like to validate, if a parsed JSON complies with a JSON schema file, which is parsed by itself. There is a JSON schema module for Jackson (https://github.com/FasterXML/jackson-module-jsonSchema). However, it appears to me that its primary focus is on creating a JSON schema file from within Java. What is a good way to validate a