Questions tagged [python-jsonschema]

126 questions
0
votes
2 answers

Can I validate that nodes exist that edges in a graph point to with JSON SCHEMA?

I want to describe a network graph of vertices and edges with JSON Schema. An example JSON could look like this: { "V": [ "1", "2", "3" ], "E": [ { "v1": "1", "v2": "2" }, { "v1": "2", "v2": "3" …
0
votes
1 answer

Best way to pin point validation error cause with python jsonschema if/then/else statements

I am a big fan of python jsonshema. I recently found the if/then/else options which I really like. However, I have a huge problem with it. Let's say I have: { "required": ["PROP1"], "additionalProperties": True, "properties": { …
Greg7000
  • 297
  • 3
  • 15
0
votes
0 answers

Pyspark read json column has invalid characters

I'm reading a JSON in pyspark and seeing the below issue. Column name "change(me)" contains invalid characters, please use alias to rename it I have tried to use withColumnRenamed but that does not seem to help df =…
RData
  • 959
  • 1
  • 13
  • 33
0
votes
1 answer

Can't reference a subschema in json schema

So I am working on this problem where I have to validate the json schema based on some conditions. If xy-ac is in the schema then I want source to be present there as well. It is required. Currenlty, I am doing this in code by checking if source not…
0
votes
0 answers

Validating flattened json keys and schemas

Im trying to find a way to validate flattened json-keys. For example, lets say I have a schema defined as below: { "$schema":"http://json-schema.org/draft-04/schema#", "title":"Employee", "type":"object", "additional_properties":false, …
0
votes
0 answers

Pydantic not playing nicely with Json Schema oneOf

I'm trying to create a pydantic model of a json schema I'm using with oneOf. The basic schema is as follows: { "$schema": "https://json-schema.org/draft/2019-09/schema", "type": "object", "title": "v2_test", "additionalProperties":…
Cole
  • 116
  • 7
0
votes
2 answers

JSON schema requiring patternProperties

I'm looking for help in defining the JSON schema which would validate the below sample JSON. I don't know the country codes before hand, so they can be any country code actually. In other words, I cannot use "US" or "IN" directly in the schema. Each…
museshad
  • 498
  • 1
  • 8
  • 18
0
votes
1 answer

Set defaults from JSON schema during validation

I try to make a validator that would set defaults from a JSON schema during validation. I found this question: Trying to make JSON Schema validator in Python to set default values and adjusted it a bit. Since I use "jsonschema==3.2.0", I came up…
hidden
  • 141
  • 5
0
votes
1 answer

How to validate an array of custom objects with jsonschema in Python

I have this primary schema for each one of my data points: data_schema = { "type": "object", "properties": { "name": {"type": "string"}, "city": {"type": "string"}, "distance": {"type": "number"}, "extrovert": {"type": "boolean"}, …
KZiovas
  • 3,491
  • 3
  • 26
  • 47
0
votes
1 answer

JsonSchema logging deprecated warnings to schema

I want to log a warning when a deprecated property is being used or when the value of that property is in a deprecated format. I'm using the deprecated annotation for that but it doesn't do anything. I stumbled on this similar question jsonschema:…
Felipe Hsu
  • 64
  • 5
0
votes
1 answer

Json schema for a complex JSON?

I have a json that uses object of objects in place of an array, to easily search through the data with json keys. How can I validate this against a schema, without hardcoding the key into the schema ? Should I be converting the object into an array…
0
votes
1 answer

json-schema : Get a list of additionalProperties?

Is it possible to get a list of all additionalProperties found by json-schema ? For example, if my schema looks like this : { "type": "object", "properties": { "firstName": { "type": "string", }, "lastName": { "type":…
0
votes
1 answer

Python - Validate all rows in JSON file against schema

I am trying to validate all rows in my JSON data file against the schema without looping through each data entry in the JSON file. However when just passing in the entire JSON file no validation errors are returned. When looping through each row in…
0
votes
1 answer

Error handling for json-schema redefined type_checker in python

I'm using json-schema to validate a schema. I wanted to customize the date-time type. So, redefined the type accordingly and extended the validator. But, it's not returning the error the way I'm looking for. My code: BaseVal =…
Ash Nazg
  • 514
  • 3
  • 6
  • 14
0
votes
1 answer

Can I import table in a JSON Schema validation?

I am writing a JSON schema validation. I have an ID field whose values are imported from a table in SQL Server. These values are large and are frequently updated, so is there a way to dynamically connect to this table in the server and validate the…
1 2 3
8 9