Commit 29038ba1 authored by Paul Warren's avatar Paul Warren

More documentation.

parent f46b71f3
Pipeline #111 canceled with stages
......@@ -54,16 +54,16 @@ properties that may or may not be present. For example:
```python
someJSON.get("thing", {}).get("subThing", None)
if subThing is not None:
...
... # "thing" or "subThing" not present
```
What is less easy is guarding against properties being present with the wrong type. For example:
What is less easy is guarding against properties being present with the wrong type. For example, if `thing` is a list:
```python
json.loads('{"thing": [ ] }').get("thing", {}).get("subThing", None)
```
Gives:
We get:
```
AttributeError: 'list' object has no attribute 'get'
......@@ -76,6 +76,12 @@ readable than doing type checks manually in code.
Short JSON Schema is intended to allow concise specification of JSON formats,
so that your code needn't be cluttered with checks for the correct structure.
## Scope
Short JSON Schema supports a subset of JSON Schema functionality. The
`shortjsonschema` Python module converts Short JSON Schema syntax into standard
JSON Schema.
## Defaults
In Short JSON Schema, properties are required by default, and additional
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment