jsonschema

validation of json schema having oneOf keyword

落爺英雄遲暮 提交于 2019-12-24 11:31:25
问题 I have the following json schema for my web app. { "type":"object", "properties": { "person_identifier":{ "type":"object", "oneOf":[ {"$ref":"#/person_identifier/rememberme_id"}, {"$ref":"#/person_identifier/email"}, {"$ref":"#/person_identifier/account_number"} ], "email":{ "type":"string" }, "rememberme_id":{ "type":"string" }, "account_number":{ "type":"string" } } } } My goal is to accept only one of the three "person_identifier"-email, rememberme_id or account_number in the api request

validation of json schema having oneOf keyword

馋奶兔 提交于 2019-12-24 11:29:12
问题 I have the following json schema for my web app. { "type":"object", "properties": { "person_identifier":{ "type":"object", "oneOf":[ {"$ref":"#/person_identifier/rememberme_id"}, {"$ref":"#/person_identifier/email"}, {"$ref":"#/person_identifier/account_number"} ], "email":{ "type":"string" }, "rememberme_id":{ "type":"string" }, "account_number":{ "type":"string" } } } } My goal is to accept only one of the three "person_identifier"-email, rememberme_id or account_number in the api request

JSON Schema - conditional validation

倾然丶 夕夏残阳落幕 提交于 2019-12-24 10:51:21
问题 I have the following Schema. I've implemented it as best I can, but it's still not working quite as I want it to. { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "title": "Ordering pizza", "propertyNames": { "enum": [ "q-who-did-you-order-from", "q-did-they-accept-your-order", "q-how-much-was-the-bill", "q-why-didnt-they-accept" ] }, "properties": { "q-who-did-you-order-from": { "type": "string", "title": "Who have you ordered pizza from?", "maxLength": 50,

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

How to validate json with json schema in NJsonSchema c#

孤人 提交于 2019-12-24 09:59:13
问题 As part of contract tests I have to validate json response I got from rest-endpoint against json-schema present in a file. I'm using NJsonSchema and was not able to perform this. Json-schema in file is as something below { 'type': 'object', 'properties': { 'remaining': { 'type': 'integer', 'required': true }, 'shuffled': { 'type': 'boolean', 'required': true } 'success': { 'type': 'boolean', 'required': true }, 'deck_id': { 'type': 'string', 'required': true } } } Json I have to validate is

angular6-json-schema-form issue with multi-select form change event

家住魔仙堡 提交于 2019-12-24 08:36:40
问题 The current implementation for multi-select doesn't show <mat-select [formControl]="toppings" multiple> because here for type 'array' and 'enum' it shows 'checkboxes'. So, I have overridden that behavior in the following way: myCustomWidgets = { submit: NoneComponent, checkboxes: CustomMultiSelectComponent }; I have created a MaterialSelectComponent file which is a copy of the same file from 'angular6-json-schema-form' and then added the custom widget like below. <json-schema-form

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

How to use JSON schema oneOf for arrays with fixed values

对着背影说爱祢 提交于 2019-12-24 08:12:05
问题 I want to specify multiple values for oneOf and have defined the below schema that validates successfully (http://json-schema-validator.herokuapp.com/). Note there is deliberately only one value under oneOf in this example. { "id": "test-schema", "$schema": "http://json-schema.org/draft-04/schema#", "description": "test schema", "type": "object", "properties": { "alpha": { "type": "object", "properties": { "beta": { "oneOf": [ { "type": "object", "properties": { "ObjA": { "type": "object",

Go structs to OpenAPI to JSONSchema generation automatically

蹲街弑〆低调 提交于 2019-12-24 01:29:15
问题 I have a Go struct for which I want to generate an OpenAPI schema automatically. Once I have an OpenAPI definition of that struct I wanna generate JSONSchema of it, so that I can validate the input data that comes and is gonna be parsed into those structs. The struct looks like the following: // mySpec: io.myapp.MinimalPod type MinimalPod struct { Name string `json:"name"` // k8s: io.k8s.kubernetes.pkg.api.v1.PodSpec v1.PodSpec } Above struct is clearly an augmentation of what Kubernetes

How to validate a JSON object against a JSON schema based on object's type described by a field?

时光毁灭记忆、已成空白 提交于 2019-12-23 10:05:53
问题 I have a number of objects (messages) that I need to validate against a JSON schema (draft-04). Each objects is guaranteed to have a "type" field, which describes its type, but every type have a completely different set of other fields, so each type of object needs a unique schema. I see several possibilities, none of which are particularly appealing, but I hope I'm missing something. Possibility 1: Use oneOf for each message type. I guess this would work, but the problem is very long