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): 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