Skip to content

Commit f97ec06

Browse files
author
Boris Cherny
committed
[Docs] Document customName option in readme
1 parent 5f3039a commit f97ec06

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ See [server demo](example) and [browser demo](https://github.com/bcherny/json-sc
8686
|-|-|-|-|
8787
| additionalProperties | boolean | `true` | Default value for `additionalProperties`, when it is not explicitly set |
8888
| bannerComment | string | `"/* eslint-disable */\n/**\n* This file was automatically generated by json-schema-to-typescript.\n* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,\n* and run json-schema-to-typescript to regenerate this file.\n*/"` | Disclaimer comment prepended to the top of each generated file |
89+
| customName | `(LinkedJSONSchema, string | undefined) => string | undefined` | `undefined` | Custom function to provide a type name for a given schema
8990
| cwd | string | `process.cwd()` | Root directory for resolving [`$ref`](https://tools.ietf.org/id/draft-pbryan-zyp-json-ref-03.html)s |
9091
| declareExternallyReferenced | boolean | `true` | Declare external schemas referenced via `$ref`? |
9192
| enableConstEnums | boolean | `true` | Prepend enums with [`const`](https://www.typescriptlang.org/docs/handbook/enums.html#computed-and-constant-members)? |

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export interface Options {
3232
* Disclaimer comment prepended to the top of each generated file.
3333
*/
3434
bannerComment: string
35+
/**
36+
* Custom function to provide a type name for a given schema
37+
*/
38+
customName?: (schema: LinkedJSONSchema, keyNameFromDefinition: string | undefined) => string | undefined
3539
/**
3640
* Root directory for resolving [`$ref`](https://tools.ietf.org/id/draft-pbryan-zyp-json-ref-03.html)s.
3741
*/
@@ -77,10 +81,6 @@ export interface Options {
7781
* Generate unknown type instead of any
7882
*/
7983
unknownAny: boolean
80-
/**
81-
* Custom function to provide a type name for a given schema
82-
*/
83-
customName?: (schema: LinkedJSONSchema, keyNameFromDefinition: string | undefined) => string | undefined
8484
}
8585

8686
export const DEFAULT_OPTIONS: Options = {

0 commit comments

Comments
 (0)