jsonschema

JSON schema validator in Scala

眉间皱痕 提交于 2019-12-05 19:20:29
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 import and use of the json-schema-validator https://github.com/fge/json-schema-validator . Also I am not

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

懵懂的女人 提交于 2019-12-05 18:49:52
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 better maintained and less buggy, the only one of the two in PyPI. My directory tree created by Django 1.11

Use object property keys as enum in JSON schema

落爺英雄遲暮 提交于 2019-12-05 15:53:59
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", "group": "dairy" } }, "groups": { "fruits": { "name": "Fruits" }, "vegetables": { "name": "Vegetables" }

json-schema: how to transform from one json-schema to another

假如想象 提交于 2019-12-05 14:03:49
I have the two different json-schemas : schemaA -> A calendar as defined at http://json-schema.org/calendar { "$schema": "http://json-schema.org/draft-04/schema#", "description": "A representation of an event", "type": "object", "required": [ "dtstart", "summary" ], "properties": { "dtstart": { "format": "date-time", "type": "string", "description": "Event starting time" }, "dtend": { "format": "date-time", "type": "string", "description": "Event ending time" }, "summary": { "type": "string" }, "location": { "type": "string" }, "url": { "type": "string", "format": "uri" }, "duration": {

What is the difference between “anyof” and “oneof” in z schema?

有些话、适合烂在心里 提交于 2019-12-05 10:23:15
Its looking like both works fine with my input validation code. Then what is the exact difference? Schema with oneof [{ "id": "MyAction", "oneOf": [{ "$ref": "A1" }, { "$ref": "A2" }] }, { "id": "A1", "properties": { "class1": { "type": "string"}, "class2": { "type": "string"} } }, { "id": "A2", "properties": { "class2": { "type": "string"}, "class3": { "type": "string"} } } ] Schema with anyof [{ "id": "MyAction", "anyOf": [{ "$ref": "A1" }, { "$ref": "A2" }] }, { "id": "A1", "properties": { "class1": { "type": "string"}, "class2": { "type": "string"} } }, { "id": "A2", "properties": {

specify a value can be a string or null with json schema

允我心安 提交于 2019-12-05 08:33:30
问题 Hopefully this isn't obvious to others because I find the docs at http://json-schema.org/ to be lacking in finer details. I'm getting a block of json with some properties that can be null or a string. How do you specify, in a json schema (to be parsed by json.NET's JsonSchema.Parse method), that a value can be of type null or type string? Is there something simple I'm missing like supplying an array for the type? For example; "member_region": { "type": [ "string", null ] } // this throws an

Enforce object non emptyness using json schema

六眼飞鱼酱① 提交于 2019-12-05 05:21:14
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 schema excerpt looks like this: "attribute": { "type": "object", "additionalProperties": { "type": [

Validate JSON schema compliance with Jackson against an external schema file

て烟熏妆下的殇ゞ 提交于 2019-12-05 04:40:46
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 JSON schema in Java? - preferably using Jackson, but I am also open to other solutions. As far as

JSON schema for data description vs data validation vs input validation

断了今生、忘了曾经 提交于 2019-12-05 04:11:37
In what I can find about using JSON schema, there seems to be a confusing conflation of (or at least a lack of distinction among) the tasks of describing valid data, validating stored data, and validating input data. A typical example looks like: var schema = { type: 'object', properties: { id: { type: 'integer', required: true }, name: { type: 'string', required: true }, description: { type: 'string', required: false } } }; This works well for describing what valid data in a data store should look like, and therefore for validating it (the latter isn't terribly useful—if it's in a store it

How to define UUID property in JSON Schema and Open API (OAS)

本秂侑毒 提交于 2019-12-05 00:39:25
When using JSON Schema and Open API specification (OAS) to document a REST API, how do I define the UUID property? There's no built-in type for UUID, but the OpenAPI Specification suggests using type: string format: uuid From the Data Types section (emphasis mine): Primitives have an optional modifier property: format . OAS uses several known formats to define in fine detail the data type being used. However, to support documentation needs, the format property is an open string-valued property, and can have any value. Formats such as "email" , "uuid" , and so on, MAY be used even though