How do I validate a JSON Schema schema, in Python?

后端 未结 1 1804
Happy的楠姐
Happy的楠姐 2021-02-05 03:02

I am programmatically generating a JSON-Schema schema. I wish to ensure that the schema is valid. Is there a schema I can validate my schema against?

Please note my us

1条回答
  •  灰色年华
    2021-02-05 03:50

    Using jsonschema, you can validate a schema against the meta-schema. The core meta-schema is here, but jsonschema bundles it so downloading it is unnecessary.

    from jsonschema import Draft3Validator
    my_schema = json.loads(my_text_file) #or however else you end up with a dict of the schema
    Draft3Validator.check_schema(my_schema)
    

    0 讨论(0)
提交回复
热议问题