diff --git a/connexion/spec.py b/connexion/spec.py index 40fe46d70..ca40714f2 100644 --- a/connexion/spec.py +++ b/connexion/spec.py @@ -204,7 +204,10 @@ def enforce_string_keys(obj): return OpenAPISpecification(spec, base_uri=base_uri) def clone(self): - return type(self)(copy.deepcopy(self._raw_spec)) + try: + return type(self)(copy.deepcopy(self._raw_spec)) + except jsonschema.exceptions.RefResolutionError: + return type(self)(copy.deepcopy(self._spec)) @classmethod def load(cls, spec, *, arguments=None): diff --git a/tests/fixtures/simple/foo.yaml b/tests/fixtures/simple/foo.yaml new file mode 100644 index 000000000..80cd1bd1c --- /dev/null +++ b/tests/fixtures/simple/foo.yaml @@ -0,0 +1,7 @@ +title: foo +type: object +properties: + foo: + type: string + foo4: + type: string diff --git a/tests/fixtures/simple/openapi.yaml b/tests/fixtures/simple/openapi.yaml index c4ce61773..4eb59aab1 100644 --- a/tests/fixtures/simple/openapi.yaml +++ b/tests/fixtures/simple/openapi.yaml @@ -180,12 +180,7 @@ paths: content: application/json: schema: - type: object - properties: - foo: - type: string - foo4: - type: string + $ref: ./foo.yaml /exploded-deep-object-param-additional-properties: get: summary: Returns dict response with flexible properties