ts-runtime-validation 1.2.0 → 1.2.1
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 +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,6 +16,15 @@ This is a code generator that is designed to run as a yarn / npm script. By defa
|
|
|
16
16
|
|
|
17
17
|
The helper file assumes you have [ajv-validator](https://github.com/ajv-validator/ajv) peer dependency installed. Since this is only a code generation tool this package can be installed as a dev dependency.
|
|
18
18
|
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# yarn
|
|
23
|
+
yarn add --dev ts-runtime-validation
|
|
24
|
+
# npm
|
|
25
|
+
npm install --dev ts-runtime-validation
|
|
26
|
+
```
|
|
27
|
+
|
|
19
28
|
## CLI usage
|
|
20
29
|
|
|
21
30
|
Ensure your project files containing the schemas you want to validate end with the prefix `.jsonschema.ts`
|
|
@@ -32,6 +41,21 @@ Options:
|
|
|
32
41
|
-h, --help display help for command
|
|
33
42
|
```
|
|
34
43
|
|
|
44
|
+
## npm script usage
|
|
45
|
+
|
|
46
|
+
The intended use for ts-runtime-validation is as a npm script. Here it can also be tweaked to watch (eg. using nodemon)
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"scripts": {
|
|
51
|
+
"generate-types": "ts-runtime-validation"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"ts-runtime-validation": "^1.2.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
35
59
|
## Example usage of generated ts type validation
|
|
36
60
|
|
|
37
61
|
```typescript
|