Skip to content

Commit 0b59d2c

Browse files
committed
update inlinePathParameters and useBigInt
1 parent 0b6644c commit 0b59d2c

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

fern/products/sdks/pages/typescript/configuration.mdx

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,20 @@ public async post(
307307

308308
</ParamField>
309309

310-
<ParamField path="inlinePathParameters" type="boolean">
310+
<ParamField path="inlinePathParameters" type="boolean" default="true">
311+
Inline path parameters into request types.
312+
313+
`inlinePathParameters: false`:
314+
315+
```typescript
316+
await service.getFoo("pathParamValue", { id: "SOME_ID" });
317+
```
318+
319+
`inlinePathParameters: true`:
320+
```typescript
321+
await service.getFoo({ pathParamName: "pathParamValue", id: "SOME_ID" });
322+
```
323+
311324
</ParamField>
312325

313326
<ParamField path="namespaceExport" type="string">
@@ -388,7 +401,55 @@ By default, names are based on the organization and API names in the Fern Defini
388401

389402
</ParamField>
390403

391-
<ParamField path="useBigInt" type="boolean">
404+
<ParamField path="useBigInt" type="boolean" default="false">
405+
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.
406+
407+
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.
408+
However, when disabling the serialization layer (`no-serde: true`), they will be typed as `number | bigint`.
409+
410+
Here's an overview of what to expect from the generated types when combining `useBigInt` and `noSerde` with the following Fern definition:
411+
412+
*Fern definition*:
413+
414+
```yaml
415+
types:
416+
ObjectWithOptionalField:
417+
properties:
418+
longProp: long
419+
bigIntProp: bigint
420+
```
421+
422+
*TypeScript output*:
423+
424+
```typescript
425+
// useBigInt: true
426+
// noSerde: false
427+
interface ObjectWithLongAndBigInt {
428+
longProp: bigint;
429+
bigIntProp: bigint;
430+
}
431+
432+
// useBigInt: true
433+
// noSerde: true
434+
interface ObjectWithLongAndBigInt {
435+
longProp: bigint | number;
436+
bigIntProp: bigint | number;
437+
}
438+
439+
// useBigInt: false
440+
// noSerde: false
441+
interface ObjectWithLongAndBigInt {
442+
longProp: number;
443+
bigIntProp: string;
444+
}
445+
446+
// useBigInt: false
447+
// noSerde: true
448+
interface ObjectWithLongAndBigInt {
449+
longProp: number;
450+
bigIntProp: string;
451+
}
452+
```
392453
</ParamField>
393454

394455
<ParamField path="useBrandedStringAliases" type="boolean" default="false">

0 commit comments

Comments
 (0)