-
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.
Merge pull request #5 from mnboos/dev
v1.3.1
- Loading branch information
Showing
7 changed files
with
90 additions
and
15 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,2 +1,6 @@ | ||
# 1.3.1 | ||
- Fix: Properly catch cycles in refs | ||
# 1.3.0 | ||
- oneOf support for arrays added | ||
# 1.2.0 | ||
- Ref support added |
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.2.0" | ||
version = "1.3.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,14 @@ | ||
{ | ||
"properties": { | ||
"array": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"oneOf": [ | ||
{"type": "string", "default": "foobar"}, | ||
{"type": "integer"} | ||
] | ||
} | ||
} | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"alice": { "$ref": "#/definitions/bob" }, | ||
"bob": { "$ref": "#/definitions/alice" } | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"alice": { "$ref": "#/definitions/alice" } | ||
} | ||
} |
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,12 @@ | ||
import jsonschema_default as js | ||
import pytest | ||
|
||
|
||
def test_simple_ref(): | ||
obj = js.create_from("./schemas/ref/simple.json") | ||
assert obj == {"billing_address": {"street": "samplestreet", "city": "", "state": ""}} | ||
|
||
|
||
def test_ref_cycle(): | ||
with pytest.raises(Exception, match="Cyclic refs are not allowed") as excinfo: | ||
js.create_from("./schemas/ref/cycle.json") |