diff --git a/jsf/tests/data/anyof_true.json b/jsf/tests/data/anyof_true.json new file mode 100644 index 0000000..25934ff --- /dev/null +++ b/jsf/tests/data/anyof_true.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "new_parent": { "type": "boolean" }, + "new_subsidiary": { "type": "boolean" }, + "new_sibling": { "type": "boolean" } + }, + "additionalProperties": false, + "anyOf": [ + { "properties": { "new_parent": { "const": true } } }, + { "properties": { "new_subsidiary": { "const": true } } }, + { "properties": { "new_sibling": { "const": true } } } + ] +} diff --git a/jsf/tests/data/min-required-props-oneof.json b/jsf/tests/data/min-required-props-oneof.json deleted file mode 100644 index 5b4b4f4..0000000 --- a/jsf/tests/data/min-required-props-oneof.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "object", - "friendly_name": "Corporate Structure Changes", - "description": "Parameters for corporate structure changes", - "properties": { - "new_parent": { "const": true }, - "new_subsidiary": { "const": true }, - "new_sibling": { "const": true } - }, - "oneOf": [ - { "required": ["new_parent"] }, - { "required": ["new_subsidiary"] }, - { "required": ["new_sibling"] } - ] -} diff --git a/jsf/tests/test_default_fake.py b/jsf/tests/test_default_fake.py index 2a341f5..b5cd74b 100644 --- a/jsf/tests/test_default_fake.py +++ b/jsf/tests/test_default_fake.py @@ -546,8 +546,8 @@ def test_use_defaults_and_examples(TestData): assert breed is None or breed == "Mixed Breed" -def test_min_required_props_oneof(TestData): - with open(TestData / "min-required-props-oneof.json") as file: +def test_anyof_true(TestData): + with open(TestData / "anyof_true.json") as file: schema = json.load(file) p = JSF(schema) fake_data = [p.generate(use_examples=True) for _ in range(100)] @@ -556,7 +556,7 @@ def test_min_required_props_oneof(TestData): assert isinstance(d, dict) assert len(d.keys()) >= 1 assert all(isinstance(v, bool) for v in d.values()) - assert all(d.values()) + assert any(d.values()) def test_bool_enum(TestData):