Skip to content

Commit d557a26

Browse files
authored
Merge pull request #1326 from bkueng/yaml_parsing_link
docs: add link to check-jsonschema for how to handle generic yaml parsing
2 parents 51506b9 + 4f3a664 commit d557a26

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

docs/referencing.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ Here for instance we retrieve YAML documents in a way similar to the `above <ref
220220
JSON Schema is defined specifically for JSON, and has well-defined behavior strictly for Python objects which could have possibly existed as JSON.
221221

222222
If you stick to the subset of YAML for which this is the case then you shouldn't have issue, but if you pass schemas (or instances) around whose structure could never have possibly existed as JSON (e.g. a mapping whose keys are not strings), all bets are off.
223+
For an example on how to handle that, have a look at the `parsers/yaml.py <https://github.com/python-jsonschema/check-jsonschema/blob/main/src/check_jsonschema/parsers/yaml.py>`_ file in the check-jsonschema repository.
223224

224225
One could similarly imagine a retrieval function which switches on whether to call ``yaml.safe_load`` or ``json.loads`` by file extension (or some more reliable mechanism) and thereby support retrieving references of various different file formats.
225226

0 commit comments

Comments
 (0)