Commit e957fc5
Fix single-body JSON overload skip for models-mode: typeddict spread bodies
The skip condition sniffed for a combined-type member with base == typeddict,
but in models-mode: typeddict a spread body inserts the original base: dpg
model as its overload (it renders as a TypedDict via models-mode). That made
the sniff false, so the single-body JSON overload was wrongly kept, regressing
the prior behavior where the TypedDict overload replaced it.
Track this explicitly with a jsonOverloadReplacedByTypeddict flag set by
add_body_param_type wherever a TypedDict-style overload is inserted (both the
generate-typeddict dpg path via _insert_typeddict_overload and the
typeddict-only spread branch). add_overloads_for_body_param now checks the flag
instead of sniffing base == typeddict, so:
- models-mode: dpg (generate-typeddict on) and models-mode: typeddict both skip
the single-body JSON overload, and
- only the generate-typeddict: false opt-out keeps it (pre-TypedDict behavior).
Addresses the PR reviewer comment.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 753f3788-98a9-4e39-8655-9c6a3ce905361 parent 025eceb commit e957fc5
2 files changed
Lines changed: 76 additions & 6 deletions
File tree
- packages/http-client-python
- generator/pygen/preprocess
- tests/unit
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
389 | 390 | | |
390 | 391 | | |
391 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
392 | 396 | | |
393 | 397 | | |
394 | 398 | | |
| |||
487 | 491 | | |
488 | 492 | | |
489 | 493 | | |
490 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
491 | 497 | | |
492 | 498 | | |
493 | 499 | | |
| |||
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
153 | 217 | | |
154 | 218 | | |
155 | 219 | | |
| |||
0 commit comments