Skip to content

Commit f4abc34

Browse files
committed
Sync open source content 🐝 (from eef5fa577879d5937a276a60ac3ed3a66e6c8b5f)
1 parent ae9e2e0 commit f4abc34

File tree

1 file changed

+58
-36
lines changed

1 file changed

+58
-36
lines changed

docs/sdks/manage/forward-compatibility.mdx

Lines changed: 58 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -196,45 +196,69 @@ Generator options enable additional forward compatibility features. These are co
196196
<Table
197197
data={[
198198
{
199-
feature: "Forward-compatible enums",
200-
typescript: "",
201-
python: "Coming soon",
202-
go: "",
203-
java: "",
204-
csharp: "Not supported",
199+
language: "TypeScript",
200+
enums: "",
201+
unions: "",
202+
requiredFields: "",
203+
laxCoercion: "",
204+
smartUnions: "",
205205
},
206206
{
207-
feature: "Forward-compatible unions",
208-
typescript: "",
209-
python: "Not supported",
210-
go: "Not supported",
211-
java: "",
212-
csharp: "Not supported",
207+
language: "Python",
208+
enums: "In progress",
209+
unions: "In progress",
210+
requiredFields: "Contact us",
211+
laxCoercion: "Built-in (Pydantic)",
212+
smartUnions: "Built-in (Pydantic)",
213213
},
214214
{
215-
feature: "Lax mode",
216-
typescript: "",
217-
python: "Built-in (Pydantic)",
218-
go: "Via respectRequiredFields: false",
219-
java: "Not supported",
220-
csharp: "Not supported",
215+
language: "Go",
216+
enums: "In progress",
217+
unions: "In progress",
218+
requiredFields: "",
219+
laxCoercion: "Contact us",
220+
smartUnions: "",
221221
},
222222
{
223-
feature: "Smart union deserialization",
224-
typescript: "",
225-
python: "Built-in (Pydantic)",
226-
go: "",
227-
java: "",
228-
csharp: "Not supported",
223+
language: "Java",
224+
enums: "",
225+
unions: "In progress",
226+
requiredFields: "",
227+
laxCoercion: "Contact us",
228+
smartUnions: "",
229+
},
230+
{
231+
language: "C#",
232+
enums: "Contact us",
233+
unions: "Contact us",
234+
requiredFields: "Contact us",
235+
laxCoercion: "Contact us",
236+
smartUnions: "Contact us",
237+
},
238+
{
239+
language: "Ruby",
240+
enums: "Contact us",
241+
unions: "Contact us",
242+
requiredFields: "Contact us",
243+
laxCoercion: "Contact us",
244+
smartUnions: "Contact us",
245+
},
246+
{
247+
language: "PHP",
248+
enums: "Contact us",
249+
unions: "Contact us",
250+
requiredFields: "Contact us",
251+
laxCoercion: "Contact us",
252+
smartUnions: "Contact us",
229253
},
230254
]}
231255
columns={[
232-
{ key: "feature", header: "Feature" },
233-
{ key: "typescript", header: "TypeScript" },
234-
{ key: "python", header: "Python" },
235-
{ key: "go", header: "Go" },
236-
{ key: "java", header: "Java" },
237-
{ key: "csharp", header: "C#" },
256+
{ key: "language", header: "Language" },
257+
{ key: "enums", header: "Enums" },
258+
{ key: "unions", header: "Unions" },
259+
{ key: "requiredFields", header: "Required fields" },
260+
{ key: "laxCoercion", header: "Lax coercion" },
261+
{ key: "smartUnions", header: "Smart unions" },
238262
]}
239263
/>
240264

@@ -262,9 +286,7 @@ Generator options enable additional forward compatibility features. These are co
262286
language: "yaml",
263287
code: `java:
264288
forwardCompatibleEnumsByDefault: true
265-
unionStrategy: populated-fields
266-
openUnions: true
267-
generateOptionalUnionAccessors: true`,
289+
unionStrategy: populated-fields`,
268290
},
269291
{
270292
label: "Python",
@@ -277,7 +299,7 @@ Generator options enable additional forward compatibility features. These are co
277299

278300
### Forward-compatible enums
279301

280-
When `forwardCompatibleEnumsByDefault` is enabled (the default for new TypeScript, Go, and Java SDKs), enums accept unknown values instead of rejecting the response:
302+
When `forwardCompatibleEnumsByDefault` is enabled (the default for new TypeScript SDKs), enums accept unknown values instead of rejecting the response:
281303

282304
```typescript
283305
const notification = await sdk.notifications.get(id);
@@ -287,7 +309,7 @@ const notification = await sdk.notifications.get(id);
287309

288310
### Forward-compatible unions
289311

290-
When `forwardCompatibleUnionsByDefault` is enabled (TypeScript) or `openUnions` is enabled (Java), discriminated unions accept unknown variants:
312+
When `forwardCompatibleUnionsByDefault` is enabled (TypeScript), discriminated unions accept unknown variants:
291313

292314
```typescript
293315
const account = await sdk.accounts.getLinkedAccount();
@@ -322,7 +344,7 @@ Go SDKs can achieve similar resilience with `respectRequiredFields: false`, whic
322344

323345
### Smart union deserialization
324346

325-
When `unionStrategy` is set to `populated-fields` (the default for new TypeScript, Go, and Java SDKs), the SDK picks the best union variant by trying all types and returning the one with the most matching fields. When there's a tie, it picks the variant with the fewest coerced or inexact fields.
347+
When `unionStrategy` is set to `populated-fields` (the default for new TypeScript and Go SDKs), the SDK picks the best union variant by trying all types and returning the one with the most matching fields. When there's a tie, it picks the variant with the fewest coerced or inexact fields.
326348

327349
This prevents issues where one union variant is a subset of another and the wrong variant gets selected due to ordering.
328350

0 commit comments

Comments
 (0)