json-schema-validator

JSON Schema Conditional Statements

╄→гoц情女王★ 提交于 2020-12-07 16:29:17
问题 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'}} },

create Ref-resolver from $ref in jsonschema in python draft7

安稳与你 提交于 2020-06-17 12:56:52
问题 I have json Schema { "$id": "d:/documents/schemaFiles/WLWorkProduct/1", "$schema": "http://json-schema.org/draft-07/schema#", "title": "WLWorkProduct", "description": "", "type": "object", "properties": { "RID": { "description": "resource type.", "type": "string" }, "Data": { "type": "object", "properties": { "IndividualTypeProperties": { "allOf": [ { "$ref": "d:/documents/schemaFiles/WorkProduct/1" }, { "type": "object", "properties": { "WID": { "type": "string", "description": "WID" } } } ]

create Ref-resolver from $ref in jsonschema in python draft7

≯℡__Kan透↙ 提交于 2020-06-17 12:56:31
问题 I have json Schema { "$id": "d:/documents/schemaFiles/WLWorkProduct/1", "$schema": "http://json-schema.org/draft-07/schema#", "title": "WLWorkProduct", "description": "", "type": "object", "properties": { "RID": { "description": "resource type.", "type": "string" }, "Data": { "type": "object", "properties": { "IndividualTypeProperties": { "allOf": [ { "$ref": "d:/documents/schemaFiles/WorkProduct/1" }, { "type": "object", "properties": { "WID": { "type": "string", "description": "WID" } } } ]

Is it possible to create a JSON Schema with allOf (multiple if and then) and $ref?

荒凉一梦 提交于 2020-05-29 10:15:50
问题 I am trying to create a complex schema that will check for the value of a property and then validate according to the value of that same property. I am wondering if it's possible to use $ref and allOf in the same schema and if so, how? I am having some trouble getting this to work. It may be important to note that I am using AJV. Please see my code below { "$ref": "#/definitions/Welcome", "definitions": { "Welcome": { "properties": { "auth": { "type": "string", "enum": ["oauth1","oauth2"] },

Is there a way to raise an error for any additional key present in JSON if I am using the if-else condition of JSON Schema?

烂漫一生 提交于 2020-05-15 07:59:05
问题 I have a use case where I want to check the keys present in JSON, depending on the value of a different key. Example JSON-1: { "key_name" : "value1", "foo" : "random_value1" } Example JSON-2: { "key_name" : "value2", "bar" : "random_value2" } As per these examples, Rule 1. If the value of "key_name" is "value1" then only "foo" key should be present in JSON. Rule 2. If the value of "key_name" is "value2", then only "bar" key should be present in JSON. I have written the following JSON Schema

How to add a request validator in a AWS SAM template for AWS::Serverless::Api?

删除回忆录丶 提交于 2020-04-08 18:08:12
问题 I'm trying to use AWS SAM to link a request validator resource to a serverless API in a SAM template. I have created the request validator and referenced the API in its RestApiId but the validator doesn't get set as the API default validator option in the AWS console. AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > Discription for the template Globals: Function: Timeout: 30 Resources: MyAPI: Type: AWS::Serverless::Api Properties: Name: MyAPI