@@ -143,17 +143,17 @@ def resolve_recursive(reference: Any, schemas_seen: list[str] | None = None):
143
143
reference .clear ()
144
144
reference .update (type = "object" )
145
145
else :
146
- schemas_seen .append (schema )
147
146
try :
148
147
resolved_value = reduce (lambda d , k : d [k ], ref_keys , api_spec )
149
148
except KeyError as e :
150
149
logger .warning (
151
150
f"SKIPPED: Unable to resolve '$ref' for '{ new_reference } ' (KeyError: { e } )"
152
151
)
153
152
else :
153
+ schemas_seen .append (schema )
154
154
if has_reference (resolved_value ):
155
155
resolved_value = resolve_recursive (resolved_value , schemas_seen = schemas_seen )
156
- schemas_seen .remove ( schema )
156
+ schemas_seen .pop ( )
157
157
if isinstance (resolved_value , dict ):
158
158
reference .update (resolved_value )
159
159
else :
@@ -244,17 +244,18 @@ def adjust_recursive(
244
244
245
245
@staticmethod
246
246
def _collect_endpoint_tags (resolved_api_spec : dict [str , Any ]) -> list [str ]:
247
- tags = []
247
+ collected_tags = []
248
248
249
249
def collect (obj ):
250
250
if isinstance (obj , dict ):
251
- if "tags" in obj :
252
- tags .extend (obj ["tags" ])
251
+ tags = obj .get ("tags" )
252
+ if tags and isinstance (tags , list ) and all (isinstance (t , str ) for t in tags ):
253
+ collected_tags .extend (tags )
253
254
else :
254
255
for k , v in obj .items ():
255
256
collect (obj [k ])
256
257
257
258
collect (resolved_api_spec ["paths" ])
258
- if not tags :
259
- tags .append ("default" )
260
- return list (set (tags ))
259
+ if not collected_tags :
260
+ collected_tags .append ("default" )
261
+ return list (set (collected_tags ))
0 commit comments