Forward compatibility
Fern SDKs are designed so that you can evolve your API without breaking users on legacy SDKs. You can safely add additional response properties, enum values, and union variants. The legacy SDKs will safely handle deserializing extra information.
TypeScript
Additional Response Properties
As you make new response properties available,
the legacy SDKs will continue to work. For example, let’s say you
generated an SDK that had the following Movie
object:
If you decided to add a new genre
property on your server, the SDK will
simply pass the extra property back. Users would also be able to access
the property by doing
Additional Enum values
As you add additional enum properties on your server, the
legacy SDKs will continue to work. For example, let’s say your generated SDK
had the following Genre
type:
If you decided to add a new enum value comedy
, the SDK will simply pass
the string value back to the user. The consumer can then handle this case
in the default case of a switch statement.
Additional union variants
Similar to additional enum properties, if you add additional union types
on your server, the legacy SDKs will continue to work. For example, let’s say your
generated SDK had the following Shape
type:
If you decided to add an additional union type called Triangle
then the user could simply handle the unknown case in their legacy SDK.