diff --git a/jsonsubschema/_checkers.py b/jsonsubschema/_checkers.py index d2033a1..f25a7e4 100644 --- a/jsonsubschema/_checkers.py +++ b/jsonsubschema/_checkers.py @@ -359,10 +359,6 @@ def _joinString(s1, s2): if s1_new_pattern and s2_new_pattern: ret["pattern"] = "^" + s1_new_pattern + \ "$|^" + s2_new_pattern + "$" - elif s1_new_pattern: - ret["pattern"] = "^" + s1_new_pattern + "$" - elif s2_new_pattern: - ret["pattern"] = "^" + s2_new_pattern + "$" return JSONTypeString(ret) else: return JSONanyOf({"anyOf": [s1, s2]}) diff --git a/test/test_string.py b/test/test_string.py index b5e1337..ae6b285 100644 --- a/test/test_string.py +++ b/test/test_string.py @@ -212,6 +212,11 @@ def test_enum3(self): with self.subTest(): self.assertFalse(isSubschema(s2, s1)) + def test_enum4(self): + s1 = {"anyOf": [{"enum": ["a", "b", "c"]}, {"type": "string"}]} + s2 = {"type": "string"} + self.assertTrue(isEquivalent(s1, s2)) + def test_not_enum1(self): s1 = {"type": "string", "not": {"enum": ["a"]}} s2 = {"type": "string"}