Skip to content

Commit 8adc9d0

Browse files
p1-alexandrevaneyp1-ra
authored andcommitted
fix recursive ref lookup when original ref has already been incremented
1 parent 2157ccc commit 8adc9d0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

openapi_python_client/resolver/collision_resolver.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import hashlib
2-
from typing import Any, Dict, List, Tuple
2+
import re
33

4+
from typing import Any, Dict, List, Tuple
45
from .reference import Reference
56
from .resolver_types import SchemaData
67

@@ -72,7 +73,9 @@ def _get_from_ref(self, ref: Reference, attr: SchemaData) -> SchemaData:
7273
self._errors.append(f"Did not find data corresponding to the reference {ref.value}")
7374

7475
if list(cursor) == ["$ref"]:
75-
ref2 = Reference(cursor["$ref"], self._parent)
76+
ref2 = cursor["$ref"]
77+
ref2 = re.sub(r'(.*)_\d',r'\1',ref2)
78+
ref2 = Reference(ref2, self._parent)
7679
if ref2.is_remote():
7780
attr = self._refs[ref2.abs_path]
7881
return self._get_from_ref(ref2, attr)

0 commit comments

Comments
 (0)