json-schema-validator

Reference remote enum values from json-schema

时间秒杀一切 提交于 2021-02-10 12:54:06
问题 In my schema definitions, I have a type, with an integer property which should be any of a "fixed" set of numbers. The problem is that this "fixed set" may be changed often. "person": { "type": "object", "properties": { "aproperty": { "type": "integer", "enum": [1, 12, 30 ... , 1000] }, } }, Is there any way to reference this array from a remote service (which will have the most updated set)? "person": { "type": "object", "properties": { "aproperty": { "type": "integer", "$ref": "http:/

make json schema pattern case insensitive

末鹿安然 提交于 2021-02-07 12:05:42
问题 in my json schema i made a definition for "colors" like this { "colors": { "type":"string", "pattern": "AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGray|DarkGrey|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGray|DarkSlateGrey|DarkTurquoise

make json schema pattern case insensitive

眉间皱痕 提交于 2021-02-07 12:04:27
问题 in my json schema i made a definition for "colors" like this { "colors": { "type":"string", "pattern": "AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGray|DarkGrey|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGray|DarkSlateGrey|DarkTurquoise

handling infinity values in JSON

笑着哭i 提交于 2021-02-05 11:34:06
问题 I need at one place to have the support for infinity, -infinity and NaN values in my JSON. Now though JSON does have support for these values, but is there any support for specifying about them in the schema of the same JSON instance, I mean the RFC specification says that these values are not supported under "number" type. However, when I validated one such JSON instance having infinity value against a schema with the type "number", it produced no error! Can someone help me to figure out why

Two way binding dependences based on enum value in json schema

可紊 提交于 2021-01-28 02:21:41
问题 I have a senior were I have to validate the schema for below json data. { 'userId': 123, 'userType': CUSTOMER } Information about JSON: Were userId is an integer and the userType is enum ['Customer','Admin','Guest'] So the issue is that I want to validate the JSON data from the JSON schema based on : If userId is present then userType is required. If userType ['Customer','Admin'] is present but userId is not then it should not validate the JSON data. But if the userType is ['Guest'] then

How to validate a object based on the value of root object in json schema?

醉酒当歌 提交于 2020-12-15 06:42:17
问题 I want to validate sale date and customer availability based on the value of ordertype.(Note., They are not under same object).Is there any way to validate child values based on root value? { "type": "object", "properties": { "Order": { "type": "object", "properties": { "OrderDetails": { "type": "object", "properties": { "OrderType": { "type": "string", "enum": [ "Y", "N" ] } } } } }, "Sale": { "type": "object", "properties": { "Saledate": { "format": "date"/*should be present when OrderType

How to validate a object based on the value of root object in json schema?

微笑、不失礼 提交于 2020-12-15 06:42:16
问题 I want to validate sale date and customer availability based on the value of ordertype.(Note., They are not under same object).Is there any way to validate child values based on root value? { "type": "object", "properties": { "Order": { "type": "object", "properties": { "OrderDetails": { "type": "object", "properties": { "OrderType": { "type": "string", "enum": [ "Y", "N" ] } } } } }, "Sale": { "type": "object", "properties": { "Saledate": { "format": "date"/*should be present when OrderType

JSON Schema Conditional Statements

寵の児 提交于 2020-12-07 16:32:45
问题 I am trying to validate what I thought was a simple JSON schema as a configuration file for my Python application, it's a list of header key/value pairs, the only complication is that if the 'Type' field is set to 'AnyValue' then the value key is not required. Here is the schema as it is: { "definitions": { 'KeyEntry': { "properties": { 'Type': {"type" : "string"}, 'Key': {"type": "string"} }, "required": ['Type', 'Key'], "anyOf": [ { "if": { "properties": {'Type': {"const": 'ExactValue'}} },

JSON Schema Conditional Statements

若如初见. 提交于 2020-12-07 16:31:55
问题 I am trying to validate what I thought was a simple JSON schema as a configuration file for my Python application, it's a list of header key/value pairs, the only complication is that if the 'Type' field is set to 'AnyValue' then the value key is not required. Here is the schema as it is: { "definitions": { 'KeyEntry': { "properties": { 'Type': {"type" : "string"}, 'Key': {"type": "string"} }, "required": ['Type', 'Key'], "anyOf": [ { "if": { "properties": {'Type': {"const": 'ExactValue'}} },

JSON Schema Conditional Statements

若如初见. 提交于 2020-12-07 16:30:20
问题 I am trying to validate what I thought was a simple JSON schema as a configuration file for my Python application, it's a list of header key/value pairs, the only complication is that if the 'Type' field is set to 'AnyValue' then the value key is not required. Here is the schema as it is: { "definitions": { 'KeyEntry': { "properties": { 'Type': {"type" : "string"}, 'Key': {"type": "string"} }, "required": ['Type', 'Key'], "anyOf": [ { "if": { "properties": {'Type': {"const": 'ExactValue'}} },