Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
JSON
Short JSON Schema
Commits
29038ba1
Commit
29038ba1
authored
Oct 18, 2019
by
Paul Warren
Browse files
More documentation.
parent
f46b71f3
Pipeline
#111
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
29038ba1
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment