Discriminated Unions
The SDKs natively support discriminated unions for both OpenAPI and Fern APIs.
TypeScript
Go
Callers can create a Shape
object by simply constructing the appropriate type. For example, creating
a Triangle
shape looks like the following:
Consumers can easily write branching logic by checking the discriminant.