Questions tagged [python-jsonschema]

126 questions
0
votes
1 answer

JSON Schema relative references resolution

I am trying to define a valid JSON Schema and I am not sure how to structure the reference ("$ref") values when referenced components are in sub-directories. I have read (at length) the info at the official JSON Schema site as well as examined test…
0
votes
1 answer

How to create dynamic form using JSONSchemaField based on ID passed from the form request in Django?

The form is rendering properly if I give ID as a static value in forms.py, it wont render properly when I use the ID that I got from form call views.py def assetAddJsonView(request,pk): form = AssetAddjsonForm(id = pk) context = { …
0
votes
1 answer

How to generate json schema from python dict

I am looking for a python library for json_schema generation from python dictoinary for e.g this dictionary fields = { "field1": {"title": "Field1 Title", "type": "string"}, "field2": {"title": "Field2 Title", "type": "integer"}, "field3":…
0
votes
1 answer

JSON Schema object types not working for $ref definitions

I am using JSON Schema Draft-07. I am having a JSON Schema like below that works as expected { "tests": { "type": "object", "required": [ "name", "desc" ], "properties": { "name": { "type":…
curiousguy
  • 3,212
  • 8
  • 39
  • 71
0
votes
1 answer

How to ref JSON schema definition of type array with anyOf definition in other files

I have a jsonschema definition definition-1.json like below. I have a property called inputs of type array which refers anyOf definitions like "inputs": { "type": "array", "items": { "anyOf": [ { "$ref":…
curiousguy
  • 3,212
  • 8
  • 39
  • 71
0
votes
1 answer

How do I require one of two jsonschema properties, but also set a default?

I try to validate a jsonschema that defines a circle either with a radius or a diameter or neither and then just sets a default radius. This is my schema: { "properties": { "position": {}, "radius": { { "type": "number" } }, …
0
votes
0 answers

I need assistance in building my own json schema

How do I build my own json schema to validate the json coming back from an api is the same structure? I have this sample JSON { "httpStatus": 200, "httpStatusMessage": "success", "timestamp": "2020-11-11T19:32:45", "response": { …
0
votes
1 answer

JSON with Python: No expected validation errors with jsonschema

I have defined a schema and used it to validate JSON objects but I never get the expected ValidationError. For example: >>> from jsonschema import validate >>> schema = { ... "type" : "object", ... "properties" : { ... "address" : {"type"…
James Adams
  • 8,448
  • 21
  • 89
  • 148
0
votes
1 answer

Validating unknown property name in json schema in python

schema = { "type" : "object", "properties" : { "price" : {"type" : "array", "items" : { "type" : "string" , "pattern": "^[A-Za-z0-9_]*$" }}, }, } from…
ankitj
  • 335
  • 4
  • 13
0
votes
1 answer

How to create JSON objects Folder name and File Name View

I have a JSON File Like this: { "Sheet1": [ { "Folder name": "Folder 1", "Filename": "1- Introduction.mp4", }, { "Filename": "2- Prerequisites.mp4", }, { …
0
votes
1 answer

Parse List in nested dictionary Python

data = { "persons": {"1": {"name": "siddu"}, "2": {"name": "manju"}}, "cars": { "model1": { "make": 1990, "company_details": { "name": "Ford Corporation", "country": "US", …
0
votes
1 answer

Can't get references between