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
Copy file name to clipboardExpand all lines: README.md
+33-32Lines changed: 33 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,10 +29,11 @@ npm install -g ajv-cli
29
29
30
30
## JSON schema version
31
31
32
-
Parameter `--spec` can be used with all commands (other than help) to define which JSON schema version is used:
32
+
Parameter `--spec` can be used with all commands (other than help) to define which JSON schema language is used:
33
33
34
34
-`--spec=draft7` (default) - support JSON Schema draft-07 (uses `import Ajv from "ajv"`)
35
35
-`--spec=draft2019` - support JSON Schema draft-2019-09 (uses `import Ajv from "ajv/dist/2019"`)
36
+
-`--spec=jtd` - support JSON Type Definition (uses `import Ajv from "ajv/dist/jtd"`)
36
37
37
38
## Commands
38
39
@@ -148,7 +149,7 @@ This command also supports parameters `-r`, `-m` and `-c` as in [validate](#vali
148
149
149
150
This command validates and migrates schema from JSON Schema draft-04 to JSON Schema draft-07 or draft-2019-09 using [json-schema-migrate](https://github.com/epoberezkin/json-schema-migrate) package.
150
151
151
-
The [version of JSON Schema](#json-schema-version) is determined by `--spec` parameter (`"draft7"` or `"draft2019"`).
152
+
The [version of JSON Schema](#json-schema-version) is determined by `--spec` parameter (only `"draft7"` or `"draft2019"`).
152
153
153
154
```sh
154
155
ajv migrate -s schema
@@ -202,36 +203,36 @@ This command supports the same options and parameters as [validate](#validate-da
202
203
203
204
You can pass the following [Ajv options](https://github.com/ajv-validator/ajv/blob/master/docs/api.md#options):
|`--strict-tuples=`| throw on (`true`) or ignore (`false`) [strict tuples](https://github.com/ajv-validator/ajv/blob/master/docs/strict-mode.md#prohibit-unconstrained-tuples) restrictions (the default is to log) |
210
-
|`--strict-types=`| throw on (`true`) or ignore (`false`) [strict types](https://github.com/ajv-validator/ajv/blob/master/docs/strict-mode.md#strict-types) restrictions (the default is to log) |
211
-
|`--allow-matching-properties`| allow `properties`[matching patterns](https://github.com/ajv-validator/ajv/blob/master/docs/strict-mode.md#prohibit-overlap-between-properties-and-patternproperties-keywords) in `patternProperties`|
|`--use-defaults`| replace missing properties/items with the values from default keyword |
223
-
|`--coerce-types`| change type of data to match type keyword |
224
-
| Advanced |
225
-
|`--multiple-of-precision`| precision of multipleOf, pass integer number |
226
-
|`--messages=false`| do not include text messages in errors |
227
-
|`--loop-required=`| max size of `required` to compile to expression (rather than to loop) |
228
-
|`--loop-enum=`| max size of `enum` to compile to expression (rather than to loop) |
229
-
|`--own-properties`| only validate own properties (not relevant for JSON, but can have effect for JavaScript objects) |
230
-
| Code generation |
231
-
|`--code-es5`| generate ES5 code |
232
-
|`--code-lines`| generate multi-line code |
233
-
|`--code-optimize=`| disable optimization (`false`) or number of optimization passes (1 pass by default) |
234
-
|`--code-formats=`| code to require formats object (only needed if you generate standalone code and do not use [ajv-formats](https://github.com/ajv-validator/ajv-formats)) |
|`--strict-tuples=`| throw on (`true`) or ignore (`false`) [strict tuples](https://github.com/ajv-validator/ajv/blob/master/docs/strict-mode.md#prohibit-unconstrained-tuples) restrictions (the default is to log)|
211
+
|`--strict-types=`| throw on (`true`) or ignore (`false`) [strict types](https://github.com/ajv-validator/ajv/blob/master/docs/strict-mode.md#strict-types) restrictions (the default is to log)|
212
+
|`--allow-matching-properties`| allow `properties`[matching patterns](https://github.com/ajv-validator/ajv/blob/master/docs/strict-mode.md#prohibit-overlap-between-properties-and-patternproperties-keywords) in `patternProperties`|
|`--use-defaults`| replace missing properties/items with the values from default keyword|
224
+
|`--coerce-types`| change type of data to match type keyword|
225
+
| Advanced |
226
+
|`--multiple-of-precision`| precision of multipleOf, pass integer number|
227
+
|`--messages=false`| do not include text messages in errors|
228
+
|`--loop-required=`| max size of `required` to compile to expression (rather than to loop)|
229
+
|`--loop-enum=`| max size of `enum` to compile to expression (rather than to loop)|
230
+
|`--own-properties`| only validate own properties (not relevant for JSON, but can have effect for JavaScript objects)|
231
+
| Code generation |
232
+
|`--code-es5`| generate ES5 code|
233
+
|`--code-lines`| generate multi-line code|
234
+
|`--code-optimize=`| disable optimization (`false`) or number of optimization passes (1 pass by default)|
235
+
|`--code-formats=`| code to require formats object (only needed if you generate standalone code and do not use [ajv-formats](https://github.com/ajv-validator/ajv-formats))|
235
236
236
237
Options can be passed using either dash-case or camelCase.
0 commit comments