-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
default '0' did not work as intended anymore
- Loading branch information
Showing
6 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# 1.4.1 | ||
- fix regression and assure code works as intended (see #9) | ||
# 1.4.0 | ||
- 'const' support added | ||
# 1.3.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "jsonschema-default" | ||
version = "1.4.0" | ||
version = "1.4.1" | ||
description = "Create default objects from a JSON schema" | ||
authors = ["Martin Boos <[email protected]>"] | ||
maintainers = ["Martin Boos <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"properties": { | ||
"number": { | ||
"type": "number", | ||
"default": 0 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"properties": { | ||
"number": { | ||
"type": "number", | ||
"default": 0, | ||
"const": 123 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import json | ||
import jsonschema_default as js | ||
from pathlib import Path | ||
import re | ||
|
||
|
||
def test_default(): | ||
obj = js.create_from("./schemas/default/default.json") | ||
assert obj == {"number": 0} | ||
|
||
|
||
def test_default_and_const(): | ||
""" | ||
If both 'default' and 'const' are defined, 'default' has higher precedence | ||
:return: | ||
""" | ||
|
||
obj = js.create_from("./schemas/default/default_and_const.json") | ||
assert obj == {"number": 0} |