jsonschema

Equal of xsi:type in JSON Schema

久未见 提交于 2019-12-13 04:46:16
问题 How can I hint the type of embedded objects in JSON Schema, analogous to xsi:type in XML Schema? Example schema document: { "type": "storeRequest", "properties": { "txid": { "description": "Transaction ID to prevent double committing", "type": "integer" }, "objects": { "description": "Objects to store", "type": "array" "items": { "type": "object" }, "minItems": 1, "uniqueItems": true }, }, "required": ["txid", "objects"] } This is a request the client sends to the server to store multiple

Is possible optimize json.net schema with JSchemaValidatingReader to deserialize in object in same read of stream?

我与影子孤独终老i 提交于 2019-12-13 00:05:32
问题 I'm trying a poc. Is possible optimize json.net schema with JSchemaValidatingReader to deserialize in object in same read of stream? In otherworld string schemaJson = @"{ 'description': 'A person', 'type': 'object', 'properties': { 'name': {'type': 'string'}, 'hobbies': { 'type': 'array', 'items': {'type': 'string'} } } }"; JSchema schema = JSchema.Parse(schemaJson); using (StreamReader s = File.OpenText(@"c:\bigdata.json")) using (JSchemaValidatingReader reader = new JSchemaValidatingReader

Android, Gradle and duplicate files error during packaging

我与影子孤独终老i 提交于 2019-12-12 08:59:21
问题 I want to use the json-schema-validator in my Android project like this: dependencies { compile 'com.github.fge:json-schema-validator:2.1.8' } Unfortunately Gradle stops packaging due to this file duplicate error: Path in archive: draftv3/schema Origin 1: /Users/andrej/.gradle/caches/modules-2/files-2.1/com.github.fge/json-schema-validator/2.1.8/4c2a5be8ce86c2338561a651d7d22fb4c4a8763d/json-schema-validator-2.1.8.jar Origin 2: /Users/andrej/.gradle/caches/modules-2/files-2.1/com.github.fge

AJV schema validation for nested object

爷,独闯天下 提交于 2019-12-12 04:46:55
问题 Functions returns object which looks something like this: { "answer": { "vehicle_type": 1, "message": "Car" }, "model": "VW", "color": "red" } 'Answer' object is always there. Other fields are there based on 'vehicle_type'. E.g. if vehicle_type = 1 there are 'model' and 'color'. if vehicle_type = 2 there are 'engine_count', 'seat_count' and 'wing_count'. I am trying to write JSON-schema which I will use to validate returned object. I would like to set 'model' and 'color' as required

FHIR json schema

走远了吗. 提交于 2019-12-12 03:54:31
问题 Is there a complete or partial JSON schema for HL7 FHIR resources? I saw this. http://www.interopen.org/candidate-profiles/care-connect/CareConnect-AllergyIntolerance-1.html But the JSON scchema is not available. This is also not functioning. 回答1: JSON schemas will be published as a standard part of release 3. You can find the current draft here: http://build.fhir.org/fhir.schema.json.zip There's still a bit of fine-tuning to do. Feedback welcome. 回答2: You can run on your computer terminal:

Maintain directory hierarchy when converting from XSD to JAVA Class?

杀马特。学长 韩版系。学妹 提交于 2019-12-12 01:53:53
问题 I have a set of XSD Schemas , that are present in a directory structure . I am using JAXB to convert it into Java Classes . Now when converting it it breaks the schema into several classes and puts them into the default package. I can override the default package but i would like to maintain the same directory structure of the XSD. Does this mean i will have to convert each XSD one at a time by hand. Also , since it is breaking the single XSD into multiple classes , it will make it tough for

jsonschema filter out invalid items

不问归期 提交于 2019-12-11 19:45:49
问题 I'm using https://www.npmjs.com/package/jsonschema to validate an incoming JSON array that looks something like this { "source": "app", "data": [ { "customerId": "1", "Address": { "number": "1", "street": "st1" } }, { "customerId": "2", "Address": { "number": "2", "street": "st1" } }, { "customerId": "3", "Address": { "number": "3" } } ] } In this data the third item customerId: 3 is invalid since it's missing the street field in address . Is there any way for me to get out the filtered items

JSON Schema if-else condition complex scenario

馋奶兔 提交于 2019-12-11 18:23:51
问题 { "policyHolder": { "fullName": "A" }, "traveller": [ { "fullName": "B", "relationship": "Spouse" }, { "fullName": "A", "relationship": "My Self" } ] } In above json, I want to validate that if "relationship" = "My Self" then fullName must match the fullName in policyHolder A field relationship must exist in traveller array, else json is invalid I have tried to create a json schema with if-else , allOf , etc. but nothing works which can do these validations but not able to. Please help!!

How to validate JSON Schema according to Draft v4 using JSON.NET Schema or NJSONSchema?

让人想犯罪 __ 提交于 2019-12-11 15:03:46
问题 I have been looking into both JSON.NET Schema and NJsonSchema ... Both dont seem to have any propert / method that identifies if JSON Schema is a valid JSON Schema and in accordance with draft v4 Compatible. Is it that only an exception that will identify if a schema is valid, and even if its vaid, how will i check that its draft v4 Comatible? 回答1: You can use a JSON schema that describes JSON schema and use that to validate the JSON. You can find a copy here - http://www.jsonschemavalidator

JSON Schema Validation based on a property

老子叫甜甜 提交于 2019-12-11 14:57:34
问题 I have been trying to get my JSON schema right. I have a boolean property based on which I have to determine the required properties. Below is my sample JSON which I want to fail the validation with item3 not present. { "item1": true, "item2": "ABC" } This is the JSON which I want the validation to pass { "item1": true, "item2": "ABC", "item3": { "subItem1": "ABC", "subItem2": "BAC" } } Similarly, if the item1 is false , then the validation should pass for both the above JSON's. My JSON