Skip to content

Commit bb4dfe5

Browse files
author
Arunoday
authored
Fix unresponsive Swagger-UI for circular model refs
This PR resolves issue #10616 by adding a recursion guard in model.jsx to handle circular $ref references in schemas, preventing infinite rendering loops and displaying a warning instead.
1 parent 04b9ad7 commit bb4dfe5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test-circular.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
### Description
2+
This PR resolves issue #10616 where Swagger-UI becomes unresponsive when expanding certain operations that include circular model references.
3+
4+
### Root Cause
5+
Circular `$ref` references in schemas cause infinite recursion in the React component tree while rendering model properties.
6+
7+
### Solution
8+
Added a recursion guard in `model.jsx` that:
9+
- Tracks visited schema references
10+
- Prevents infinite rendering loops
11+
- Displays a short warning for circular structures instead
12+
13+
### Reproduction
14+
1. Create a simple OpenAPI file with a self-referencing schema:
15+
```yaml
16+
components:
17+
schemas:
18+
User:
19+
type: object
20+
properties:
21+
manager:
22+
$ref: '#/components/schemas/User'

0 commit comments

Comments
 (0)