From 7b1d748fa1625e1603c60f64b16c53b74c1ff7b0 Mon Sep 17 00:00:00 2001 From: James Kent Date: Thu, 21 Mar 2024 13:22:30 -0500 Subject: [PATCH 1/2] clone _spec instead of _raw_spec --- connexion/spec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connexion/spec.py b/connexion/spec.py index 40fe46d70..83322b1c4 100644 --- a/connexion/spec.py +++ b/connexion/spec.py @@ -204,7 +204,7 @@ def enforce_string_keys(obj): return OpenAPISpecification(spec, base_uri=base_uri) def clone(self): - return type(self)(copy.deepcopy(self._raw_spec)) + return type(self)(copy.deepcopy(self._spec)) @classmethod def load(cls, spec, *, arguments=None): From 10b8fd91898b02c4fb18d6240798dd5afd026ada Mon Sep 17 00:00:00 2001 From: James Kent Date: Thu, 21 Mar 2024 13:22:46 -0500 Subject: [PATCH 2/2] add clone test --- tests/test_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_api.py b/tests/test_api.py index 818be5896..dd8523efd 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -201,6 +201,9 @@ def test_relative_refs(relative_refs, spec): spec_path = relative_refs / spec specification = Specification.load(spec_path) assert "$ref" not in specification.raw + # clone specification + specification_clone = specification.clone() + assert "$ref" not in specification_clone.raw @pytest.fixture