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
Add --include flag: further limits files from tsconfig.json. (YousefED#211)
* Add --include flag: further limits files from tsconfig.json.
In a large project, it is slow and not needed to extract schemata from
all TypeScript files in `tsconfig.json` (also it can be infeasible due
to limitations of what can be converted to JSON schema). OTOH listing
the files as the command-line argument ignores all the parameters from
`tsconfig.json`. `--include` gets us the advantages of both.
Tests for --include flag (and programFromConfig).
(PR ready: no generated files).
* Document --include flag.
* Fix lint error.
* Update README.md
Copy file name to clipboardexpand all lines: README.md
+4
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,9 @@ Generate json-schemas from your Typescript sources.
16
16
* Install with `npm install typescript-json-schema -g`
17
17
* Generate schema from a typescript type: `typescript-json-schema project/directory/tsconfig.json TYPE`
18
18
19
+
To generate files for only _some_ types in `tsconfig.json` specify
20
+
filenames or globs with the `--include` option. This is especially useful for large projects.
21
+
19
22
In case no `tsconfig.json` is available for your project, you can directly specify the .ts files (this in this case we use some built-in compiler presets):
20
23
21
24
* Generate schema from a typescript type: `typescript-json-schema "project/directory/**/*.ts" TYPE`
@@ -38,6 +41,7 @@ Options:
38
41
--useTypeOfKeyword Use `typeOf` keyword (https://goo.gl/DC6sni) for functions. [boolean] [default: false]
39
42
--out, -o The output file, defaults to using stdout
40
43
--validationKeywords Provide additional validation keywords to include [array] [default: []]
44
+
--include Further limit tsconfig to include only matching files [array] [default: []]
41
45
--ignoreErrors Generate even if the program has errors. [boolean] [default: false]
42
46
--excludePrivate Exclude private members from the schema [boolean] [default: false]
0 commit comments