From 0f933d3f33365bba4575c19ebf1d0fc970ab0b23 Mon Sep 17 00:00:00 2001 From: Zac-HD Date: Wed, 3 Feb 2021 23:24:55 +1100 Subject: [PATCH] Regression test for #65 --- tests/test_canonicalise.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_canonicalise.py b/tests/test_canonicalise.py index 86fd4e0..81d2e90 100644 --- a/tests/test_canonicalise.py +++ b/tests/test_canonicalise.py @@ -558,3 +558,19 @@ def test_validators_use_proper_draft(): } cc = canonicalish(schema) jsonschema.validators.validator_for(cc).check_schema(cc) + + +def test_reference_resolver_issue_65_regression(): + schema = { + "allOf": [{"$ref": "#/definitions/ref"}, {"required": ["foo"]}], + "properties": {"foo": {}}, + "definitions": {"ref": {"maxProperties": 1}}, + "type": "object", + } + res = resolve_all_refs(schema) + can = canonicalish(res) + assert "$ref" not in res + assert "$ref" not in can + for s in (schema, res, can): + with pytest.raises(jsonschema.ValidationError): + jsonschema.validate({}, s)