jsonschema

set Jackson ObjectMapper class not to use scientific notation for double

三世轮回 提交于 2019-12-28 17:44:59
问题 I am using a library com.fasterxml.jackson library for JsonSchema, I am creating creating an IntegerSchema object, when I set range for integer schema using below code: main(){ IntegerSchema intSchema = new IntegerSchema(); // setMaximum accepts Double object intSchema.setMaximum(new Double(102000000)); // setMaximum accepts Double object intSchema.setMinimum(new Double(100)); printJsonSchema(intSchema); } public void printJsonSchema(JsonSchema schema){ ObjectMapper mapper = new ObjectMapper(

How do I require one field or another or (one of two others) but not all of them?

人盡茶涼 提交于 2019-12-28 08:09:10
问题 I am having trouble coming up with a JSON schema that will validate if the JSON contains either: one field only another field only (one of two other fields) only but not to match when multiples of those are present. In my case specifically, I want one of copyAll fileNames matchesFiles and/or doesntMatchFiles to validate but I don't want to accept when more than that is there. Here's what I've got so far: { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [

Validate JSON against JSON Schema C#

你说的曾经没有我的故事 提交于 2019-12-28 02:05:26
问题 Is there a way to validate a JSON structure against a JSON schema for that structure? I have looked and found JSON.Net validate but this does not do what I want. JSON.net does: JsonSchema schema = JsonSchema.Parse(@"{ 'type': 'object', 'properties': { 'name': {'type':'string'}, 'hobbies': {'type': 'array'} } }"); JObject person = JObject.Parse(@"{ 'name': 'James', 'hobbies': ['.NET', 'LOLCATS'] }"); bool valid = person.IsValid(schema); // true This validates to true. JsonSchema schema =

Validate JSON against JSON Schema C#

倾然丶 夕夏残阳落幕 提交于 2019-12-28 02:03:11
问题 Is there a way to validate a JSON structure against a JSON schema for that structure? I have looked and found JSON.Net validate but this does not do what I want. JSON.net does: JsonSchema schema = JsonSchema.Parse(@"{ 'type': 'object', 'properties': { 'name': {'type':'string'}, 'hobbies': {'type': 'array'} } }"); JObject person = JObject.Parse(@"{ 'name': 'James', 'hobbies': ['.NET', 'LOLCATS'] }"); bool valid = person.IsValid(schema); // true This validates to true. JsonSchema schema =

Is it possible to have common properties before oneOf?

时光毁灭记忆、已成空白 提交于 2019-12-25 07:17:41
问题 I have this json schema that has an array that contains multiple object, and each object differs slightly from the others based on certain patterns. Example. [ { "ID": "pgID", "Name": "John", "Surname": "Doe", "ProjectsInvolved": [ "My Project", "My Project 2" ] }, { "ID": "jtID", "Name": "John", "Surname": "Doe", "WorksOn": [ "Monday", "Thursday" ] } ] The json schema for that would be: { "$schema": "http://json-schema.org/draft-04/schema", "type": "array", "items": { "oneOf": [ { "type":

Validating Heterogeneous Lists of Objects with JsonSchema and $ref

删除回忆录丶 提交于 2019-12-25 02:15:23
问题 I have seen answers to similar questions that do not quite match this particular case, so apologies if I missed a relevant answer. I have a heterogeneous array of objects that I would like to validate. These objects have the same format at the top level, but the child objects are quite different and can only be identified by the attributes present in each child. The problem maps to validating the following data, though I have more than two object types in the array: { "heterogeneous_array": [

How to use / reference field values generated in the same json schema

℡╲_俬逩灬. 提交于 2019-12-25 01:01:45
问题 I am trying to create mock data by using the json-server in combination with the json-schema-faker . I was trying to use the $ref property but I understood that this only references the type and not the exact value. Is there a way to reuse the exact same value instead of just its type? The schema I have in mockDataSchema.js file is: var schema = { "title": "tests", "type": "object", "required": [ "test" ], "properties": { "test": { "type": "object", "required": [ "id", "test2_ids", "test3" ],

Mutually exclusive combinations of properties

三世轮回 提交于 2019-12-24 21:24:42
问题 Using Jsonschema draft 6, I'm trying to create a schema that conforms to the following: Properties A, B1, B2, and B3 are either numbers or null If property A is present and non-null, then properties B, C, and D must be either absent or null If any of properties B1, B2, and B3 are present and non-null, then property A must be null or absent. A, B1, B2, and B3 may all be absent Examples of conforming documents: {} {"A": 1} {"A": 1, "B2": null} {"B1": 1} {"B1": 1, "B2": 1, "B3": 1} {"A": null,

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

好久不见. 提交于 2019-12-24 18:13:08
问题 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 another form element. The only examples given in the docs though are simple boolean's (if X has a value or not, then show Y). In my example, I need to show/hide a "placeholder" text input when the text input type selected from a select list is one

Email Markup may not Work I using Amazon SES

假如想象 提交于 2019-12-24 16:19:28
问题 Hello Guys I'm doing a email marketing with json-ld email markup the problem is that while sending test mail is not working, that is not the assigned button appears in the following code: <body> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "EmailMessage", "action": { "@type": "ViewAction", "url": "http://my-web-site-url-here.com", "name": "View Message" }, "description": "View Message" } </script> For the above code I based on one I got in an email received,