ts-runtime-validation 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -6
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -2
package/README.md
CHANGED
|
@@ -33,12 +33,16 @@ Ensure your project files containing the schemas you want to validate end with t
|
|
|
33
33
|
Usage: ts-runtime-validation [options]
|
|
34
34
|
|
|
35
35
|
Options:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
--
|
|
40
|
-
--
|
|
41
|
-
-
|
|
36
|
+
Usage: ts-runtime-validation [options]
|
|
37
|
+
|
|
38
|
+
Options:
|
|
39
|
+
--glob Glob file path of typescript files to generate ts-interface -> json-schema validations - default: *.jsonschema.{ts,tsx}
|
|
40
|
+
--rootPath RootPath of source - default: ./src
|
|
41
|
+
--output <outputFolder> Validation schema + typescript interface output directory (relative to root path) - default: ./.ts-runtime-validation (default:
|
|
42
|
+
"./.ts-runtime-validation")
|
|
43
|
+
--no-helpers Only generate JSON schema without typescript helper files
|
|
44
|
+
--additionalProperties Allow additional properties to pass validation (default: false)
|
|
45
|
+
-h, --help display help for command
|
|
42
46
|
```
|
|
43
47
|
|
|
44
48
|
## npm script usage
|
package/dist/index.js
CHANGED
|
@@ -7,13 +7,12 @@ const defaultGlobPattern = "*.jsonschema.{ts,tsx}";
|
|
|
7
7
|
const defaultRootPath = "./src";
|
|
8
8
|
const defaultOutputFolder = "./.ts-runtime-validation";
|
|
9
9
|
commander_1.program.option("--glob", `Glob file path of typescript files to generate ts-interface -> json-schema validations - default: ${defaultGlobPattern}`, defaultGlobPattern);
|
|
10
|
-
commander_1.program.option("--rootPath", `RootPath of source - default: ${defaultRootPath}`, defaultRootPath);
|
|
10
|
+
commander_1.program.option("--rootPath <rootFolder>", `RootPath of source - default: ${defaultRootPath}`, defaultRootPath);
|
|
11
11
|
commander_1.program.option("--output <outputFolder>", `Validation schema + typescript interface output directory (relative to root path) - default: ${defaultOutputFolder}`, defaultOutputFolder);
|
|
12
12
|
commander_1.program.option("--no-helpers", "Only generate JSON schema without typescript helper files", true);
|
|
13
13
|
commander_1.program.option("--additionalProperties", "Allow additional properties to pass validation", false);
|
|
14
14
|
commander_1.program.parse();
|
|
15
15
|
const options = commander_1.program.opts();
|
|
16
|
-
console.log(options);
|
|
17
16
|
const generator = new SchemaGenerator_1.SchemaGenerator(options);
|
|
18
17
|
generator.Generate();
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,uDAAoD;AACpD,yCAAoC;AAEpC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAEnD,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAUvD,mBAAO,CAAC,MAAM,CACV,QAAQ,EACR,qGAAqG,kBAAkB,EAAE,EACzH,kBAAkB,CACrB,CAAC;AACF,mBAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,uDAAoD;AACpD,yCAAoC;AAEpC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAEnD,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAUvD,mBAAO,CAAC,MAAM,CACV,QAAQ,EACR,qGAAqG,kBAAkB,EAAE,EACzH,kBAAkB,CACrB,CAAC;AACF,mBAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,iCAAiC,eAAe,EAAE,EAAE,eAAe,CAAC,CAAC;AAC/G,mBAAO,CAAC,MAAM,CACV,yBAAyB,EACzB,gGAAgG,mBAAmB,EAAE,EACrH,mBAAmB,CACtB,CAAC;AACF,mBAAO,CAAC,MAAM,CAAC,cAAc,EAAE,2DAA2D,EAAE,IAAI,CAAC,CAAC;AAClG,mBAAO,CAAC,MAAM,CAAC,wBAAwB,EAAE,gDAAgD,EAAE,KAAK,CAAC,CAAC;AAElG,mBAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,MAAM,OAAO,GAAG,mBAAO,CAAC,IAAI,EAAmB,CAAC;AAEhD,MAAM,SAAS,GAAG,IAAI,iCAAe,CAAC,OAAO,CAAC,CAAC;AAC/C,SAAS,CAAC,QAAQ,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -21,7 +21,7 @@ program.option(
|
|
|
21
21
|
`Glob file path of typescript files to generate ts-interface -> json-schema validations - default: ${defaultGlobPattern}`,
|
|
22
22
|
defaultGlobPattern
|
|
23
23
|
);
|
|
24
|
-
program.option("--rootPath", `RootPath of source - default: ${defaultRootPath}`, defaultRootPath);
|
|
24
|
+
program.option("--rootPath <rootFolder>", `RootPath of source - default: ${defaultRootPath}`, defaultRootPath);
|
|
25
25
|
program.option(
|
|
26
26
|
"--output <outputFolder>",
|
|
27
27
|
`Validation schema + typescript interface output directory (relative to root path) - default: ${defaultOutputFolder}`,
|
|
@@ -33,7 +33,6 @@ program.option("--additionalProperties", "Allow additional properties to pass va
|
|
|
33
33
|
program.parse();
|
|
34
34
|
|
|
35
35
|
const options = program.opts<ICommandOptions>();
|
|
36
|
-
console.log(options);
|
|
37
36
|
|
|
38
37
|
const generator = new SchemaGenerator(options);
|
|
39
38
|
generator.Generate();
|