Commit 320f126
fix(python): deduplicate stream condition properties in discriminated union variants (#14874)
* feat(seed): augment server-sent-events-openapi fixture with x-fern-streaming test cases
Add endpoints 8-14 covering x-fern-streaming extension patterns that have
been the source of multiple regressions:
- Endpoint 8: basic stream-condition with $ref request body (#13568)
- Endpoint 9: stream-condition with x-fern-type-name (#14256)
- Endpoints 10-11: shared request schema across streaming/non-streaming (#14291)
- Endpoint 12: discriminated union request with allOf-inherited stream
condition field, reproducing the Vectara regression (FER-9556, #14730)
- Endpoint 13: nullable stream condition field (#13605)
- Endpoint 14: x-fern-streaming with SSE format only (no stream-condition)
* chore(seed): add debug script for SSE pipeline stage inspection
Runs the locally-built Fern CLI against the server-sent-events-openapi
fixture through each transformation stage (openapi-ir, write-definition,
ir), collecting outputs in .local/results/ for inspection. Continues
past failures so all stages produce output even when earlier ones error.
Usage: pnpm tsx scripts/debug-sse-pipeline.ts
* chore(seed): comment out endpoint 9 (x-fern-type-name collision)
Endpoint 9's ChatCompletionRequest name collision blocks IR generation
for the entire fixture. Comment it out so the remaining endpoints can
be tested end-to-end. Uncomment when investigating the x-fern-type-name
disambiguation fix (PR #14256) in isolation.
* fix: deduplicate stream condition properties in discriminated union variants
When a discriminated union's variants inherit the stream condition field
from a base schema via extends, the property appeared twice in generated
Python code — once from the union's base properties (pinned as a literal)
and once from the variant's extended properties (as boolean). This caused
SyntaxError: Duplicate keyword argument in generated wire tests and
pydantic model definitions.
Two fixes:
1. DynamicTypeLiteralMapper.ts: filter objectEntries that overlap with
baseFields when building samePropertiesAsObject variant constructor args
2. simple_discriminated_union_generator.py: skip variant properties whose
wire_value matches any union base property
Fixes FER-9556
Co-Authored-By: bot_apk <apk@cognition.ai>
* chore: update ir-to-jsonschema snapshots for server-sent-events-openapi fixture
Co-Authored-By: bot_apk <apk@cognition.ai>
* chore: add server-sent-events-openapi to go-sdk allowed failures
Co-Authored-By: bot_apk <apk@cognition.ai>
* fix: preserve AST references for streaming endpoint imports in wire tests
Co-Authored-By: bot_apk <apk@cognition.ai>
* style: fix biome formatting in WireTestGenerator.ts
Co-Authored-By: bot_apk <apk@cognition.ai>
* fix: escape triple quotes in docstrings and suppress mypy overload errors in exported client wrapper
Co-Authored-By: judah <jsklan.development@gmail.com>
* chore: update seed snapshot for exported client type ignore comment
Co-Authored-By: judah <jsklan.development@gmail.com>
* fix: use actual stream condition property name in WireMock body patterns
Instead of hardcoding 'stream' in the matchesJsonPath body pattern,
extract the actual stream condition property name from the SSE endpoint's
example request body. This fixes WireMock stub routing for APIs that use
a different property name (e.g. 'stream_response' in the Vectara API).
Co-Authored-By: judah <jsklan.development@gmail.com>
* fix: use explicit None check for mypy type narrowing in wrapper class
Co-Authored-By: judah <jsklan.development@gmail.com>
* fix: update CLI changelog version ordering and regenerate IR test snapshots
Co-Authored-By: judah <jsklan.development@gmail.com>
* nit
* fix(python): replace type: ignore with proper @overload signatures in exported client wrapper
Mirror the base client's @overload signatures on the wrapper class and
use **kwargs pass-through for super().__init__(), so mypy is satisfied
without suppressing the error.
---------
Co-authored-by: jsklan <jsklan.development@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: bot_apk <apk@cognition.ai>
Co-authored-by: jsklan <100491078+jsklan@users.noreply.github.com>1 parent d00b1f5 commit 320f126
48 files changed
Lines changed: 21343 additions & 3055 deletions
File tree
- generators
- python-v2
- dynamic-snippets/src/context
- sdk/src/wire-tests
- python
- sdk
- src/fern_python
- codegen/ast/nodes/docstring
- generators
- pydantic_model/type_declaration_handler/discriminated_union
- sdk
- client_generator
- packages
- cli
- fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-events-openapi
- generation/ir-generator-tests/src
- dynamic-snippets/__test__/test-definitions
- ir/__test__/test-definitions
- commons/mock-utils
- scripts
- seed
- go-sdk
- python-sdk/server-sent-events-openapi/with-wire-tests
- src/seed
- types
- tests/wire
- wiremock
- test-definitions/fern/apis/server-sent-events-openapi
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
275 | 280 | | |
276 | 281 | | |
277 | 282 | | |
| |||
Lines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 371 | + | |
| 372 | + | |
375 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
376 | 379 | | |
377 | | - | |
378 | | - | |
379 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
380 | 385 | | |
381 | 386 | | |
382 | 387 | | |
383 | 388 | | |
384 | 389 | | |
385 | 390 | | |
386 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
387 | 397 | | |
388 | 398 | | |
389 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
3 | 24 | | |
4 | 25 | | |
5 | 26 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
187 | 189 | | |
188 | 190 | | |
189 | 191 | | |
| |||
1650 | 1652 | | |
1651 | 1653 | | |
1652 | 1654 | | |
| 1655 | + | |
| 1656 | + | |
1653 | 1657 | | |
1654 | 1658 | | |
1655 | 1659 | | |
| |||
1664 | 1668 | | |
1665 | 1669 | | |
1666 | 1670 | | |
| 1671 | + | |
| 1672 | + | |
1667 | 1673 | | |
1668 | 1674 | | |
1669 | 1675 | | |
| |||
1831 | 1837 | | |
1832 | 1838 | | |
1833 | 1839 | | |
| 1840 | + | |
1834 | 1841 | | |
1835 | 1842 | | |
1836 | 1843 | | |
1837 | 1844 | | |
1838 | 1845 | | |
1839 | 1846 | | |
| 1847 | + | |
1840 | 1848 | | |
1841 | 1849 | | |
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
609 | 626 | | |
610 | 627 | | |
611 | 628 | | |
| |||
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments