You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Controls whether the serde layer is enabled for serialization/deserialization.
326
330
327
-
No serialization/deserialization code is generated by default. The client uses `JSON.parse()` and `JSON.stringify()` instead of the default Serde layer.
328
-
329
-
When `noSerdeLayer: false`, the generated client includes a layer for serializing requests and deserializing responses. This has three benefits:
330
-
331
-
1. The client validates requests and response at runtime (client-side).
332
-
333
-
1. The client can support complex types like `Date` and `Set`.
334
-
335
-
1. The generated types can stray from the wire/JSON representation to be more
336
-
idiomatic. For example, when the Serde layer is enabled (`noSerdeLayer: false`), all properties are `camelCase`, even if the server is expecting `snake_case`.
331
+
When `noSerdeLayer: false`, the generated client includes custom serialization code that transforms property names to camelCase, validates requests/responses at runtime, and supports complex types.
337
332
333
+
See [TypeScript serde layer](/sdks/generators/typescript/serde-layer) for detailed guidance on when to enable this option.
When `useBigInt` is set to `true`, a customized JSON serializer & deserializer is used that will preserve the precision of `bigint`'s, as opposed to the native `JSON.stringify` and `JSON.parse` function which converts `bigint`'s to number's losing precision.
446
442
447
-
When combining `useBigInt` with our serialization layer (`no-serde: false`), both the request and response properties that are marked as `long` and `bigint` in OpenAPI/Fern spec, will consistently be `bigint`'s.
448
-
However, when disabling the serialization layer (`no-serde: true`), they will be typed as `number | bigint`.
443
+
When combining `useBigInt` with our serialization layer (`noSerdeLayer: false`), both the request and response properties that are marked as `long` and `bigint` in OpenAPI/Fern spec, will consistently be `bigint`'s.
444
+
However, when disabling the serialization layer (`noSerdeLayer: true`), they will be typed as `number | bigint`. See [TypeScript serde layer](/sdks/generators/typescript/serde-layer) for more information.
449
445
450
-
Here's an overview of what to expect from the generated types when combining `useBigInt` and `noSerde` with the following Fern definition:
446
+
Here's an overview of what to expect from the generated types when combining `useBigInt` and `noSerdeLayer` with the following Fern definition:
description: Control how your API naming conventions are transformed in the generated TypeScript SDK
4
+
---
5
+
6
+
Fern's TypeScript SDK generator includes an optional serde layer that determines whether the generated SDK matches your original API naming conventions (snake_case vs. camelCase, case-sensitive fields) or follows TypeScript conventions. This serde layer is controlled by the `noSerdeLayer` option.
7
+
8
+
By default, the serde layer is **disabled** (`noSerdeLayer: true`), meaning field names are preserved exactly as they appear in your API specification.
When you turn on the serde layer, (`noSerdeLayer: false`), the TypeScript SDK generator includes custom serialization code that:
23
+
- Transforms all property names from your API to camelCase
24
+
- Validates requests and responses at runtime
25
+
- Supports complex types like `Date` and `Set`.
26
+
27
+
Enable the serde layer when you want idiomatic TypeScript conventions and don't have case-sensitive field conflicts. Keep it disabled when your API has fields that differ only by casing or when you need exact field name preservation.
28
+
29
+
## Additional configuration options
30
+
31
+
Several configuration options work alongside an enabled serde layer:
32
+
- `skipResponseValidation`disables the serde layer's runtime validation while keeping its transformation features
33
+
- `allowExtraFields`permits properties not defined in your schema.
34
+
- `useBigInt`enables custom JSON handling to preserve large number precision.
35
+
36
+
These options only take effect when the serde layer is enabled (`noSerdeLayer: false`), as they require the custom serialization infrastructure.
0 commit comments