Questions tagged [python-jsonschema]

126 questions
1
vote
1 answer

How to extend the jsonschema validator?

For my project I need a new property for json schemas. I named it "isPropertyOf" and basically what I want is that if I have this: fruits = { "banana": "yellow fruit", "apple": "round fruit" } schema = { "type": "object", …
Anne Aunyme
  • 506
  • 4
  • 14
1
vote
0 answers

Nested Conditional Properties for Local file references not working in python-jsonschema

My RefResolver and Validator script is from jsonschema import RefResolver from jsonschema.validators import validator_for from tests.automation.io.helpers.loader import load_schema base = load_schema('base.schema.json') # {"$schema":…
curiousguy
  • 3,212
  • 8
  • 39
  • 71
1
vote
1 answer

Python jsonschema unable to validate JSON schema conditional nested properties

Reposting the question How to implement conditional nested properties with JSON Schema (marked as duplicate though its a completely different problem) My JSON schema reads below tried based on : JSON Schema if/then require nested object { "$id":…
curiousguy
  • 3,212
  • 8
  • 39
  • 71
1
vote
0 answers

JSON data schema allOf $ref external json schema file not working

I have recently started exploring JSON Schema for one of our project. The use case is very straight forward and after lot of googling I am still not able to make it work. Actually I am little bit lost here. . This is what I tried…
curiousguy
  • 3,212
  • 8
  • 39
  • 71
1
vote
0 answers

Jsonschema validate

I am working on a Json schema validation and below is the code. I need to have a schema check for element 'pii'. The values should only be columns defined in columns (field1,field2 or field3) with a combination of none to all column names. The…
1
vote
1 answer

How should do you update JSON values of keys which are themselves values, with python

I have 2 files, one a test.json and the other my test.py My goal is to have the value of the key "test3" update and instead of being equal to a 3(like how it is shown below), update and turn into a 10. Here is the test.json { "test": { …
1
vote
0 answers

How to add data in json file array python

I want to edit Json file and add data in json file Here is my json file I got from api response - { "options": [ { "enabled": false, "definition": { "id": "hfjhj" }, …
megha
  • 621
  • 2
  • 11
  • 36
1
vote
0 answers

What is the best way to standardise json outputs analysis from web app using python?

I am working with micro tasking web app, where task force is tagging data points for me. The questionnaire they have is flexible, meaning they can tag a data point with unlimited number of attributes. There are some defaults and required fields in…
M.wol
  • 901
  • 3
  • 10
  • 21
1
vote
1 answer

Unable to validate the 'required' properties in an array of a JSON

I have a draft-7JSON schema in a file like this: { "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "required": [ "tenantid", "owningObjectId", "owningObject", "cudAction", …
Soumendra
  • 1,518
  • 3
  • 27
  • 54
1
vote
0 answers

Python jsonschema tries to resolve $ref as a remote url. Why is it doing this?

When I attempt to validate some data with a schema: { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "splash::schema::user", "type": "object", "title": "User Schema", "definitions": { "authenticator": { "type":…
Joshua Avery
  • 314
  • 2
  • 17
1
vote
1 answer

Map "flat" JSON to complex dataclass

I am attempting to transform a "flat" JSON object to a more complex object using dataclasses and the library dataclasses-json. Unfortunately, I cannot change the JSON structure. An example of the JSON I am trying to decode, could be: j = { …
Kjell-Bear
  • 759
  • 1
  • 5
  • 12
1
vote
0 answers

recursive errors in validating oneOf in python jsonschema

Here am trying to validate my JSON schema using jsonschema(Draft7Validator) library Validating Schema: { "oneOf": [ { "required": [ "Packet" ], "properties": { "Packet": { "type": "object", …
RK Vats
  • 21
  • 3
1
vote
1 answer

How to set limit to JSON schema object's value?

I want to check particular value for multiple entry in a json file. I wrote a JsonSchema but it is not show me correct result. For example: "student": [ { "main": false, …
1
vote
1 answer

JSON Schema throw validation error if invalid optional attribute

I have a json schema as shown below which has three properties height,weight and volume which are optional. But I want to do following additional check here: If any other attributes apart from height,weight and volume is passed then it should…
min2bro
  • 4,509
  • 5
  • 29
  • 55
1
vote
0 answers

Json schema fails to validate a correct value from a enum property

I have the following schema and json, the json schema validation is failing on the log property as it could not find value "yes" on the instance. The same thing passes in the validator tool https://www.jsonschemavalidator.net/ but not in my code. I…
1 2 3
8 9