File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -185,14 +185,24 @@ implements.
185
185
.. autoclass :: Draft4Validator
186
186
187
187
For example, if you wanted to validate a schema you created against the Draft 3
188
- json schema, you could use::
188
+ json schema, you could use:
189
189
190
190
.. code-block :: python
191
191
192
192
193
- from jsonschema import Draft3Validator
194
- my_schema = json.loads(my_schema_file)
195
- Draft3Validator.check_schema(schema)
193
+ from jsonschema import Draft4Validator
194
+
195
+ schema = {
196
+ " $schema" : " http://json-schema.org/schema#"
197
+
198
+ " type" : " object" ,
199
+ " properties" : {
200
+ " name" : {" type" : " string" },
201
+ " email" : {" type" : " string" },
202
+ }
203
+ " required" : [" email" ],
204
+ }
205
+ Draft4Validator.check_schema(schema)
196
206
197
207
198
208
Validating Formats
@@ -273,4 +283,3 @@ color requires webcolors_
273
283
.. _rfc3987 : http://pypi.python.org/pypi/rfc3987/
274
284
.. _strict-rfc3339 : http://pypi.python.org/pypi/strict-rfc3339/
275
285
.. _webcolors : http://pypi.python.org/pypi/webcolors/
276
- .. _understanding_json_schema : http://spacetelescope.github.io/understanding-json-schema/
You can’t perform that action at this time.
0 commit comments