Skip to content

Commit 80fe07d

Browse files
authored
chore(docs): Document retainOriginalCasing in TypeScript generator docs (#6737) (#6788)
1 parent 580126b commit 80fe07d

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

generators/typescript/README.md

+50
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,56 @@ If `doNotHandleUnrecognizedErrors` is enabled and you throw a non-Fern error, th
360360
and passed on with `next(error)`. It's your responsibility to set up error-catching middleware that handles
361361
the error and returns a response to the client.
362362

363+
#### ✨ `retainOriginalCasing`
364+
365+
**Type:** boolean
366+
367+
**Default:** `false`
368+
369+
When enabled, property names in the generated code will retain their original casing from the API definition instead of being converted to camelCase.
370+
371+
```yaml
372+
# generators.yml
373+
config:
374+
retainOriginalCasing: true
375+
```
376+
377+
**Before (default behavior):**
378+
If your API definition has a property named `display_name`, it would be converted to `displayName` in the generated TypeScript code.
379+
380+
**After (with retainOriginalCasing):**
381+
The property `display_name` will remain as `display_name` in the generated TypeScript interfaces.
382+
383+
**Example with OpenAPI input:**
384+
```yaml
385+
# OpenAPI schema
386+
components:
387+
schemas:
388+
User:
389+
type: object
390+
properties:
391+
user_id:
392+
type: string
393+
display_name:
394+
type: string
395+
```
396+
397+
Generated TypeScript with `retainOriginalCasing: true`:
398+
```typescript
399+
export interface User {
400+
user_id: string;
401+
display_name: string;
402+
}
403+
```
404+
405+
Generated TypeScript with default settings (`retainOriginalCasing: false`):
406+
```typescript
407+
export interface User {
408+
userId: string;
409+
displayName: string;
410+
}
411+
```
412+
363413
## Versions
364414

365415
Find the latest version number and changelog for this generator in [this SDK Generators table](https://github.com/fern-api/fern?tab=readme-ov-file#sdk-generators). The changelog shows earlier version numbers, if any. You can directly use these version numbers in your generator configuration files.

0 commit comments

Comments
 (0)