Commit 5f1d743
committed
fix: Add circular reference detection to schema_helpers._expand_refs()
Fixes a ValueError: Circular reference detected error that occurs when
serpyco-rs tries to serialize connector specs with circular patterns.
The _expand_refs() function now tracks visited references during recursive
expansion to prevent infinite loops when schemas contain circular references.
This resolves issue airbytehq/oncall#9688 for the Facebook Marketing connector
and any other connectors with similar circular reference patterns in their specs.
Changes:
- Add visited_refs parameter to _expand_refs() to track reference URLs
- Skip expanding already-visited references to prevent infinite recursion
- Remove references from visited set after expansion to allow reuse in different branches
- Skip 'definitions' key during iteration to avoid re-expanding resolved definitions
- Add unit tests for circular reference handling and simple reference expansion
Co-Authored-By: unknown <>1 parent 035264c commit 5f1d743
File tree
6 files changed
+71
-11
lines changed- airbyte_cdk
- manifest_migrations
- manifest_server
- sources
- declarative
- utils
- unit_tests/sources/utils
6 files changed
+71
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3746 | 3746 | | |
3747 | 3747 | | |
3748 | 3748 | | |
3749 | | - | |
| 3749 | + | |
3750 | 3750 | | |
3751 | 3751 | | |
3752 | 3752 | | |
| |||
3763 | 3763 | | |
3764 | 3764 | | |
3765 | 3765 | | |
3766 | | - | |
| 3766 | + | |
3767 | 3767 | | |
3768 | 3768 | | |
3769 | 3769 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
93 | 103 | | |
94 | | - | |
95 | | - | |
96 | | - | |
| 104 | + | |
97 | 105 | | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | | - | |
| 109 | + | |
| 110 | + | |
101 | 111 | | |
102 | 112 | | |
103 | | - | |
| 113 | + | |
104 | 114 | | |
105 | 115 | | |
106 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
0 commit comments