fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.6k stars 139 forks source link

[FER-1986] Fix two DiscriminatedUnion bugs in dynamic Typescript snippets #3833

Closed ppod1991 closed 3 months ago

ppod1991 commented 3 months ago

Address two DiscriminatedUnion bugs in the dynamic Typescript snippets for Cohere:

1) When you try to generate snippets using discriminated unions in TypeScript, it prefixes them with ' which causes the code to be invalid. This removes the extra ` 2) Prevent extra nesting of subunion types which caused invalid JSON in the snippet

Will be followed up with a PR updating https://github.com/fern-api/fern-platform/blob/main/packages/template-resolver/src/__test__/unit-tests/__snapshots__/cohere.test.ts.snap