Russ Frank
7d1e4d2c83
Add option to not retain validator source code
...
I noticed that in a program with many schemas, a large amount of memory
was taken up by the source code strings used to compile the validators.
This commit adds an option, `retainSourceCode`, default true, which
allows source code strings to be left out of the heap.
2016-08-31 16:25:00 -07:00
Evgeny Poberezkin
9dff6474d7
feat: pass schema compilation context (it) to compiled and macro custom keyword functions, closes #280
2016-08-29 22:56:07 +01:00
Evgeny Poberezkin
00f315c31f
feat: allowedValues param in "enum" keyword error, closes #282
2016-08-29 22:42:16 +01:00
Evgeny Poberezkin
3806b9d8a3
fix: correctly resolve $data refs with absolute JSON pointers, #289
2016-08-29 22:26:33 +01:00
Evgeny Poberezkin
33081b4911
feat: pass rootData to validating functions as 5th parameters, related to #289
2016-08-29 21:52:05 +01:00
Don Rouse
53e9971edd
Add JSON pointer support to $data reference.
2016-08-25 21:35:35 -07:00
Evgeny Poberezkin
7e7219212d
feat: allow refs with protocol-relative URIs, closes #277
2016-08-15 21:53:09 +01:00
Evgeny Poberezkin
2d9241a658
feat: allow refs to fragments in "getSchema" and "validate" methods, closes #47
2016-08-15 21:22:07 +01:00
Evgeny Poberezkin
84b900889f
refactor: function to check that schema has no rules except one specified (e.g. $ref)
2016-08-07 11:05:27 +01:00
Evgeny Poberezkin
c103dc04b9
feat: support validating [meta-]schemas against themselves, closes #259
2016-08-07 00:37:30 +01:00
Evgeny Poberezkin
804764dbec
Merge pull request #266 from epoberezkin/extend-refs
...
Option "extendRefs"
2016-08-06 22:13:12 +01:00
Evgeny Poberezkin
3185847572
feat: log warning if other keywords are used with "$ref", #260
2016-08-06 21:10:57 +01:00
Evgeny Poberezkin
39b4a8f637
feat: option "extendRefs" to fail compilation or to ignore other keywords when "$ref" is used, closes #260
2016-08-06 13:05:39 +01:00
Evgeny Poberezkin
27c612755a
Merge pull request #263 from dalcib/master
...
[typescript] Allow use 'new' operator
2016-08-06 00:06:39 +01:00
Evgeny Poberezkin
321a6d1a83
fix: date-time validation, closes #261
2016-08-05 11:57:58 +01:00
Victor Emanouilov
4246d726a9
chore: move date-time guard for missing time part to date_time function rather than date function
2016-08-05 09:53:00 +03:00
Dalci de Jesus Bagolin
2fc93a8acd
[typescript] Allow use 'new' operator
2016-08-04 22:41:17 -04:00
Victor Emanouilov
6df7b2040b
fix: date-time string validation to fail validating for date-only strings instead of throwing a TypeError
2016-08-04 13:49:53 +03:00
will Farrell
a21cf02f43
update `==`, `object <-> array`
2016-07-26 14:43:20 -06:00
will Farrell
ec09c3c735
allow reversal and add more tests
2016-07-24 19:03:27 -06:00
will Farrell
4d1aa5fe31
linting
2016-07-22 18:41:57 -06:00
will Farrell
9e18e68ce7
Add in ability to coerce to an array
2016-07-22 18:07:10 -06:00
Evgeny Poberezkin
d64b84f5ff
Merge branch 'master' into 4.2
2016-07-22 15:00:44 +01:00
Evgeny Poberezkin
ac5c746f0a
Revert "Revert "feat: meta schema for custom keywords schemas, closes #230""
...
This reverts commit 09879d21ad
.
2016-07-22 14:49:43 +01:00
Evgeny Poberezkin
5a80c7cff6
feat: support meta-schema validation in custom keywords with $data support, #146
2016-07-22 14:25:41 +01:00
Evgeny Poberezkin
f06008a84f
fix: error when mutually recursive fragment refs reference a common schema, closes #240
2016-07-22 00:37:35 +01:00
Evgeny Poberezkin
7f5fe70cdb
feat: $data support in custom keywords, #146
2016-07-19 22:50:10 +01:00
Evgeny Poberezkin
ab4f65800b
refactor: remove parallel ifs from def.$data partial
2016-07-18 22:27:17 +01:00
Evgeny Poberezkin
caf7557bc0
refactor: convert custom.def partial into custom.jst function (for better encapsulation)
2016-07-18 22:14:02 +01:00
Evgeny Poberezkin
09879d21ad
Revert "feat: meta schema for custom keywords schemas, closes #230"
...
This reverts commit 1a6e4b576c
.
2016-07-18 18:51:57 +01:00
Evgeny Poberezkin
1a6e4b576c
feat: meta schema for custom keywords schemas, closes #230
2016-07-17 11:20:47 +01:00
Evgeny Poberezkin
2bcb74fc8c
fix: support mutual recursive refs when both refs are schema fragments, closes #210
2016-07-10 18:36:09 +01:00
Evgeny Poberezkin
7e0482619d
fix: support control characters in "properties" and "required", closes #226
2016-07-09 23:16:24 +01:00
Evgeny Poberezkin
3f96062745
fix: ref resolution does not fail when it should; closes #220
2016-06-28 21:30:55 +01:00
Dan Casey
3de58ec4cd
Add `schema` to interface returned by `getSchema`
2016-06-26 16:00:23 -04:00
Evgeny Poberezkin
8c0b3d8321
fix custom keyword that defines errors, closes #181
2016-06-11 12:00:10 +01:00
Evgeny Poberezkin
95c40a55d4
fix: v5 with "schemas" option when schemas dont have $schema keyword (or use v5 metaschema), closes #204
2016-06-01 07:01:46 +01:00
Evgeny Poberezkin
9a9ba82729
refactor, bump version
2016-05-27 21:21:11 +01:00
Matt Broadstone
84ef7ab728
feat(own-properties): support optionally checking own properties
...
Traditionally ajv validates additionalProperties by checking all
enumerable properties of an object. This patch allows the user to
specify that they only want own properties of an object to be
considered in this validation
2016-05-26 17:50:52 -04:00
Evgeny Poberezkin
81f442b325
NaN validation, closes #182
2016-05-16 22:05:08 +01:00
Evgeny Poberezkin
68cfec3b99
Merge pull request #184 from HolgerJeromin/patch-1
...
Copy jsdoc comments to typescript definition file
2016-05-16 20:53:44 +01:00
Evgeny Poberezkin
d90e7abd45
fix no-invalid-rule, closes #187 , #188
2016-05-16 20:51:48 +01:00
Holger Jeromin
c28a2f8f5d
Removed internal Parameters and added .errors
2016-05-13 00:54:18 +02:00
Holger Jeromin
1726e98878
copy jsdoc comment to typescript definition file
2016-05-10 11:25:18 +02:00
Evgeny Poberezkin
a8af73f45f
fix incorrect change of resolution scope when sibling subschema has id in switch keyword, issue #170
2016-04-23 19:36:47 +01:00
Evgeny Poberezkin
07f344e752
fix incorrect change of resolution scope when sibling subschema has id in allOf, oneOf, anyOf and dependencies keywords, issue #170
2016-04-23 17:00:32 +01:00
Evgeny Poberezkin
a2610bca0d
fix incorrect change of resolution scope when sibling schema has id, closes #170
2016-04-23 14:56:16 +01:00
Evgeny Poberezkin
2db1de98f3
removed unused variable
2016-04-22 10:21:51 +01:00
Blake Embrey
67f224630a
TypeScript: Fix implicit any, fix `Promise` usage
2016-04-21 17:38:06 -07:00
Evgeny Poberezkin
254deb5a03
Merge pull request #165 from epoberezkin/typescript
...
TypeScript type definitions - corrections
2016-04-20 21:20:49 +01:00
Evgeny Poberezkin
a954845be2
use typescript ES2015 for Promise support
2016-04-20 21:01:22 +01:00
Evgeny Poberezkin
f7bfc49a55
fix and add tests for typescript type definitions
2016-04-20 20:55:43 +01:00
Evgeny Poberezkin
18ca34253f
TypeScript type definitions
2016-04-18 22:11:26 +01:00
Evgeny Poberezkin
44dd6b78b9
Android 4 compatibility, #143
2016-04-18 21:15:38 +01:00
Evgeny Poberezkin
76bdf0796e
TypeScript: Promise return value for validation functions
2016-04-17 20:10:12 +01:00
Evgeny Poberezkin
e1f30a201b
TypeScript format and keyword definition
2016-04-17 20:07:00 +01:00
Evgeny Poberezkin
6a2c8633cb
correct TypeScript definitions
2016-04-17 19:37:40 +01:00
Evgeny Poberezkin
8020465d74
Merge branch 'master' into v4.0
2016-04-15 22:20:40 +01:00
Evgeny Poberezkin
26964e4996
Merge pull request #150 from lyngaas/format-exclusive-names
...
Rename exclusiveFormat to formatExclusive (v5 draft)
2016-04-15 22:16:30 +01:00
Evgeny Poberezkin
b92e6e86a7
property dependencies in allErrors mode create error for each missing dependency; #151 , closes 73
2016-04-15 22:10:30 +01:00
Blake Embrey
83427b8712
Support initial TypeScript definition
2016-04-15 12:20:35 -07:00
Evgeny Poberezkin
d730049184
meteor compatibility: error reporting, closes #159
2016-04-11 20:40:31 +01:00
Evgeny Poberezkin
84e8782605
rename property "async" of asynchronous validation function to "$async" for meteor compatibility, #151 , #159
2016-04-10 20:17:06 +01:00
Evgeny Poberezkin
d3d31d285a
Merge branch 'master' into v4.0
2016-04-10 20:03:03 +01:00
Evgeny Poberezkin
8676a3f62e
meteor compatibility; closes #159
2016-04-10 11:44:22 +01:00
Evgeny Poberezkin
404bff5bcf
error parameters for formatMaximum/formatMinimum, #151
2016-03-26 22:35:46 +00:00
Evgeny Poberezkin
e6a22be556
fix type coercion for multiple items/properties; closes #152
2016-03-25 20:13:39 +00:00
Evgeny Poberezkin
cbd9467bd6
useDefaults: use literals (deep-clone) of defaults unless useDefaults: "shared" is passed, #151 , #136
2016-03-24 23:27:13 +00:00
Evgeny Poberezkin
69d897f31a
fix errorsTexts
2016-03-23 23:25:54 +00:00
Ståle Lyngaas
98368bc363
Rename exclusiveFormat to formatExclusive (v5 draft)
2016-03-22 19:40:15 +01:00
Evgeny Poberezkin
dc10816fc3
refactor using options ignored for meta schemas
2016-03-20 18:12:14 +00:00
Evgeny Poberezkin
6a587c8729
restore readme in dotjs folder
2016-03-15 08:43:54 +00:00
Evgeny Poberezkin
ce86641657
pass default meta-schema via "meta" option, closes #90
2016-03-14 20:56:07 +00:00
Evgeny Poberezkin
192d73f74e
use meta schema from options as default meta-schema
2016-03-14 00:16:38 +00:00
Evgeny Poberezkin
f068d73693
add meta schema from option meta, #90
2016-03-13 23:15:37 +00:00
Evgeny Poberezkin
e1a38d2d90
accept array of schemas in addMetaSchema method
2016-03-09 23:20:35 +00:00
Brian Stack
bf76acfc21
Make cloning optional and based on stringify
2016-03-03 11:23:49 -08:00
Brian Stack
82f283fe7e
Clone default values to do least surprising thing
2016-03-02 16:04:21 -08:00
Evgeny Poberezkin
f4ca190010
fixed browser tests for async validation
2016-03-02 07:09:11 +00:00
Evgeny Poberezkin
53a6c70138
asynchronous custom keywords can define custom errors by returning the promise that rejects with Ajv.ValidationError, closes #118
2016-02-28 22:14:18 +00:00
Evgeny Poberezkin
3aaeaf6ec0
removeSchema with RegExp to remove multiple schemas or without argument to remove all schemas, closes #103
2016-02-28 01:16:48 +00:00
Evgeny Poberezkin
f48efb564a
optimised "not" keyword in {allErrors: true} mode to fail on the first error in subschema, closes #131
2016-02-27 23:01:03 +00:00
Evgeny Poberezkin
ec0f1c1b22
patternRequired keyword (v5 proposal), closes #123
2016-02-27 22:36:11 +00:00
Evgeny Poberezkin
503b427b7f
eslint no-trailing spaces
2016-02-26 20:25:15 +00:00
Evgeny Poberezkin
bdd1748dec
schema: false option in "validate" custom keyword definition for custom keywords that do not depend on the schema
2016-02-21 13:27:38 +00:00
Evgeny Poberezkin
8fa4d0f05f
test for passContext option
2016-02-16 10:12:32 +00:00
Evgeny Poberezkin
de65510f1e
passContext option; pass parent data to custom keyword functions
2016-02-16 00:15:20 +00:00
Evgeny Poberezkin
14d0eb0645
fix inlineRefs option, fix test, fix $ref to pass parentData[Property] to the referenced schema if it was passed to validate function
2016-02-15 22:04:04 +00:00
Evgeny Poberezkin
b2a67e7a65
options passContext (undocumented) to pass the context of validation function to referenced (not inlined) schemas
2016-02-14 20:34:10 +00:00
Evgeny Poberezkin
a0a172c90a
removeSchema called with id without matching schema does not throw error
2016-02-13 20:14:04 +00:00
Evgeny Poberezkin
79d16b3dee
alvays pass parent data and current data property when referenced schema called as a function (previously was passed only with option coerceTypes)
2016-02-12 23:08:28 +00:00
Evgeny Poberezkin
fa6b702db0
error message for enum keyword, closes #115
2016-02-07 20:03:14 +00:00
Evgeny Poberezkin
c62c6452aa
eslint: no-console
2016-02-04 22:36:12 +00:00
Evgeny Poberezkin
5c8e32dffc
eslint: no-shadow, no-invalid-this
2016-02-04 22:24:59 +00:00
Evgeny Poberezkin
5db986276c
fixed bug: custom sync keyword in async schema
2016-02-04 19:56:04 +00:00
Evgeny Poberezkin
2f6213111d
validate method for asynchronous schema always returns promise
2016-02-02 23:42:07 +00:00
Evgeny Poberezkin
cc32c46a25
update json-stable-stringify; closes #67
2016-02-02 21:39:45 +00:00
Evgeny Poberezkin
89a5ce76f9
eslint; code style
2016-02-02 18:55:02 +00:00
Evgeny Poberezkin
644a73b8f7
enable tests for nodent
2016-02-01 17:56:47 +00:00
Evgeny Poberezkin
0ecd3eaa13
change async/transpile options
2016-01-31 22:07:19 +00:00
Evgeny Poberezkin
86d97d4337
async options, expose Ajv.ValidationError class
2016-01-30 22:13:00 +00:00
Evgeny Poberezkin
c19c02aa04
nodent usage
2016-01-29 23:29:45 +00:00
Evgeny Poberezkin
2fe6715e3c
readme: async and transpile options
2016-01-29 18:01:03 +00:00
Evgeny Poberezkin
dba7096f2b
additional check for compatibility with nodent
2016-01-29 15:11:13 +00:00
Evgeny Poberezkin
6e583554a1
async with nodent transpiler
2016-01-29 09:26:11 +00:00
Evgeny Poberezkin
7365dd6e41
transpiling async validation functions from es7 with nodent
2016-01-28 12:31:20 +00:00
Evgeny Poberezkin
98c9c195aa
references to async schemas
2016-01-27 23:43:28 +00:00
Evgeny Poberezkin
002c99311f
use regenerator to transpile asynchronous validation functions if generators are not supported, #40
2016-01-26 23:56:38 +00:00
Evgeny Poberezkin
873426b6a7
async custom keywords, #40
2016-01-25 23:57:16 +00:00
Evgeny Poberezkin
d5808a3ee4
async format when format is $data, #40
2016-01-25 22:05:15 +00:00
Evgeny Poberezkin
0729d6d19d
async schemas and async formats using generators, #40
2016-01-25 06:37:36 +00:00
Evgeny Poberezkin
27bd49f182
renamed opts property of ajv instance to _opts; options object passed to constructor is copied
2016-01-25 06:37:36 +00:00
Evgeny Poberezkin
0c60364a7f
coerce type when schema is in ref that is not inlined, #95
2016-01-17 14:08:50 +00:00
Evgeny Poberezkin
878f3559f6
do not try to coerce to object/array, #95
2016-01-17 13:12:28 +00:00
Evgeny Poberezkin
b5b6a06f09
coerceTypes option, #95
2016-01-17 01:05:06 +00:00
Evgeny Poberezkin
5b7d9f9ff7
fixed inline reference resolution
2016-01-16 14:33:46 +00:00
Evgeny Poberezkin
c99d6751ad
option addUsedSchema
2016-01-15 06:54:53 +00:00
Evgeny Poberezkin
8c4557f1ac
fixed relative json-pointer pattern/code to access data
2016-01-14 21:31:00 +00:00
Evgeny Poberezkin
37dd0415da
fixed relative JSON-pointer pattern
2016-01-13 22:23:32 +00:00
Evgeny Poberezkin
8fe96db455
refactored "default" to correctly validate minProperties, minItems, etc. when defaults are present, closes #42
2016-01-09 13:28:40 +00:00
Evgeny Poberezkin
d7dd660d25
"default" keyword in "items" subschemas, #42
2016-01-09 01:37:45 +00:00
Evgeny Poberezkin
0b725bbc31
"default" keyword in "properties" subschemas, #42
2016-01-09 01:07:33 +00:00
Evgeny Poberezkin
a1afce910c
prevent scope change if definitions uses id
2016-01-04 22:28:05 +00:00
Evgeny Poberezkin
5f2cc30449
option multipleOfPrecision, closes #84
2016-01-02 17:16:01 +00:00
Evgeny Poberezkin
c3d09d7699
fixed bug in dependencies keyword, closes #94
2015-12-30 23:04:14 +00:00
Evgeny Poberezkin
2eef59dede
minified browser bundle
2015-12-27 21:33:07 +00:00
Evgeny Poberezkin
17ed9c90f4
keyword property in errors for custom keywords is set to the keyword itself instead of "custom"
2015-12-26 23:18:57 +00:00
Evgeny Poberezkin
694e81684f
throw exception if custom keyword is not an identifier; update tests as macro keyword definition supports type
2015-12-26 23:04:45 +00:00
Evgeny Poberezkin
c4786866e2
simplify compiling macro keywords
2015-12-26 22:27:13 +00:00
Evgeny Poberezkin
eab087a792
loopRequired option
2015-12-26 00:05:39 +00:00
Evgeny Poberezkin
f449f68a3d
safe access with guards to $data ref
2015-12-25 22:36:23 +00:00
Evgeny Poberezkin
1d9cad5ab7
$data ref equal to undefined is always valid
2015-12-25 20:10:15 +00:00
Evgeny Poberezkin
2d7b06a6db
support $data ref in required keyword, #81
2015-12-25 00:30:50 +00:00
Evgeny Poberezkin
2ab6aba454
support $data ref in uniqueItems, #81
2015-12-24 18:58:15 +00:00
Evgeny Poberezkin
10c6685027
support $data ref in formatMaximum/Minimum and exclusiveFormatMaximum/Minimum, #81
2015-12-24 17:43:48 +00:00
Evgeny Poberezkin
3915d22a22
refactor
2015-12-23 16:45:54 +00:00
Evgeny Poberezkin
abff815d38
refactored schema compilation to reduce browser bundle size
2015-12-23 01:50:11 +00:00
Evgeny Poberezkin
a38bf04418
refactor keywords with common code
2015-12-22 17:03:09 +00:00
Evgeny Poberezkin
cdf172c2b8
support $data ref in constant keyword, #81 ; constant keyword is implemented as inline, closes #91
2015-12-22 11:47:12 +00:00
Evgeny Poberezkin
8648a98047
support $data ref in format keyword, #81
2015-12-22 01:18:52 +00:00
Evgeny Poberezkin
ae4e6009a1
support $data ref in maximum/minimum and exclusiveMaximum/Minimum keywords, #81
2015-12-21 15:37:12 +00:00
Evgeny Poberezkin
4bb4059e80
$data ref in pattern and enum keywords, #81
2015-12-21 00:39:09 +00:00
Evgeny Poberezkin
aa18f7cab1
support $data ref in max/minLength, max/minItems and max/minProperties keywords, #81
2015-12-20 22:40:19 +00:00
Evgeny Poberezkin
9d4be9c72a
$data ref in multipleOf keyword, #81
2015-12-20 20:48:15 +00:00
Evgeny Poberezkin
32fe82697a
v5 schema allowing $data references in some keywords
2015-12-19 22:26:26 +00:00
Evgeny Poberezkin
bed46b41aa
relative-json-pointer format
2015-12-19 21:58:45 +00:00
Evgeny Poberezkin
984a70d36c
json-pointer format
2015-12-19 21:23:40 +00:00
Evgeny Poberezkin
35214f3c68
uuid format
2015-12-19 20:03:41 +00:00
Evgeny Poberezkin
ca80b2ec42
correct schemaPath for $refs, additionalProperties, additionalItems, etc.
2015-12-19 15:56:08 +00:00
Evgeny Poberezkin
1c5be913b6
correctly report schema path, #80
2015-12-19 10:52:39 +00:00
Evgeny Poberezkin
afd3831b52
semicolon
2015-12-12 22:29:45 +00:00
Evgeny Poberezkin
723258f052
v5 meta-schema
2015-12-12 21:18:41 +00:00
Evgeny Poberezkin
081f061371
more tests for switch keyword
2015-12-12 19:43:38 +00:00
Evgeny Poberezkin
b5e3e7da6e
ignore coverage for code branches where error objects are not crerated
2015-12-12 18:27:57 +00:00
Evgeny Poberezkin
8114a2b442
tests for switch keyword
2015-12-12 18:14:53 +00:00
Evgeny Poberezkin
318af74629
switch keyword
2015-12-12 13:41:51 +00:00
Evgeny Poberezkin
7c7abbbc74
"parentSchema" property added to error objects when using "verbose" option
2015-12-11 21:35:14 +00:00
Evgeny Poberezkin
610dcd17eb
replace $ in properties with $$ replace pattern, closes #87
2015-12-07 21:55:38 +00:00
Evgeny Poberezkin
5dac3dd4b3
"contains" keyword (v5) is now valid if data is not an array
2015-12-06 21:57:41 +00:00
Evgeny Poberezkin
7141f1375e
cleanup formatMaximum/formatMinimum
2015-12-06 21:25:42 +00:00
Evgeny Poberezkin
1c16707ee5
readme
2015-12-06 20:34:46 +00:00
Evgeny Poberezkin
faae5585c2
semicolon
2015-12-05 21:31:56 +00:00
Evgeny Poberezkin
d7fd8229a9
time format; formatMaximum/formatMinimum and exclusiveFormatMaximum/exclusiveFormatMinimum keywords from v5 proposals
2015-12-05 21:16:28 +00:00
Evgeny Poberezkin
5ebfb41903
fixed missing schemaPath in type keyword
2015-11-29 00:44:25 +00:00
Evgeny Poberezkin
8a0719ea27
additionalItems added to reserved keywords (can be defined as custom)
2015-11-28 16:11:56 +00:00
Evgeny Poberezkin
7d96e1b642
patternGroups keyword (v5 proposals)
2015-11-28 14:59:08 +00:00
Evgeny Poberezkin
cf35958df4
schemaPath in errors, #76
2015-11-27 09:19:04 +00:00
Evgeny Poberezkin
2ddf957554
fixed schema substitution with some options when refs are inlined, closes #77
2015-11-26 22:49:49 +00:00
Evgeny Poberezkin
06fd23217a
removed peerDependency, closes #78
2015-11-24 06:35:50 +00:00
Evgeny Poberezkin
cffb7c7f72
move compileAsync and addKeyword to Ajv prototype, remove reduce
2015-11-22 02:13:03 +00:00
Evgeny Poberezkin
a6de2b8047
addKeyword to separate file, whitespace
2015-11-22 02:07:41 +00:00
Evgeny Poberezkin
6ab3337ddf
compileAsync to separate file
2015-11-22 01:47:15 +00:00
Evgeny Poberezkin
0fe807b68a
v5 keywords constant and contains
2015-11-22 00:31:01 +00:00
Evgeny Poberezkin
65e534ee8b
check/extend errors in inline custom keywords; tests for custom keywords creating errors
2015-11-21 23:12:03 +00:00
Evgeny Poberezkin
56a8b5b582
"dependencies" with option errorDataPath = "property" sets dataPath to missing property, error params has missingProperty, #68 , #69
2015-11-21 12:43:44 +00:00
Evgeny Poberezkin
5c0c8b3b1c
default behaviour of "additionalProperties" in >=2.0.0 ( #69 ) reverts #11 - now dataPath points to the object that is validated and not to the additional property; old (<=1.4.10 ) error reporting of dataPath for "additionalProperties" keyword is available with option errorDataPath == "property"
2015-11-21 01:45:52 +00:00
Evgeny Poberezkin
79ab4add57
fixed errors for "required", tests
2015-11-20 22:52:54 +00:00
Evgeny Poberezkin
a46600e14a
default behaviour in >=2.0.0 ( #69 ) reverts #18 and #55 - now dataPath points to the object that is validated and not to the missing property; old (<=1.4.10 ) error reporting of dataPath for "required" keyword is available with option errorDataPath == "property"
2015-11-19 23:59:10 +00:00
Evgeny Poberezkin
982264f192
removed i18n option (params always added to error objects)
2015-11-17 23:45:19 +00:00
Evgeny Poberezkin
6a2961bcf3
updated error parameters so that ajv-i18n does not depend on schema, compatible with ajv-i18n >= 1.0.0
2015-11-17 23:20:12 +00:00
Evgeny Poberezkin
ee450ec8d0
removed caching of compiled subschemas of custom keywords (it made performance worse in most cases)
2015-11-17 23:20:12 +00:00
Evgeny Poberezkin
ae5b4c0f45
support for "inline" custom keywords, #69
2015-11-17 23:20:12 +00:00
Evgeny Poberezkin
87292f80ea
validate schemas generated by macro keywords
2015-11-17 23:20:12 +00:00
Evgeny Poberezkin
18c1ef858c
support for "macro" custom keywords, #69
2015-11-17 23:20:11 +00:00
Evgeny Poberezkin
285850ce20
pass parent schema to compile/validate functions of custom keywords if they use it, #69
2015-11-17 23:17:59 +00:00
Evgeny Poberezkin
5e45d4eadf
support compiling schemas in custom keywords, #69
2015-11-17 23:17:59 +00:00
Evgeny Poberezkin
fcc776e794
basic implementation of custom keywords, #69
2015-11-17 23:17:59 +00:00
Evgeny Poberezkin
368332ab42
fixed bug in remote ref resolution, closes #70
2015-11-07 13:53:41 +00:00
Evgeny Poberezkin
7b142c56bd
optimized generated code for deep schemas
2015-10-25 21:55:07 +00:00
Evgeny Poberezkin
889fcc12c5
fixed email format regex
2015-10-25 18:50:50 +00:00
Evgeny Poberezkin
c4bf67cab0
changed uri format to allow URNs, closes #59
2015-10-25 11:31:07 +00:00
Evgeny Poberezkin
d1ff86ef5e
refactor resolve
2015-10-25 01:49:07 +01:00
Evgeny Poberezkin
70844207cf
fixed resolution scope change - changing folder in subschema, closes #62
2015-10-25 01:03:19 +01:00
Evgeny Poberezkin
b161a6f1d0
fixed resolution scope change - changing folder, fixed test for #62
2015-10-24 23:16:37 +01:00
Evgeny Poberezkin
2259dc76cd
find schema ref that changes resolution scope in another schema, fixed one test for #62
2015-10-24 22:25:08 +01:00
Evgeny Poberezkin
579e5c5a1d
refactor, remove unused code, test
2015-10-16 19:37:43 +01:00
Evgeny Poberezkin
40eafe036f
removed unused code
2015-10-15 21:41:50 +01:00
Evgeny Poberezkin
50d30a262a
fixed incorrect resolution scope change when "id" property is not a schema id - closes #61 , closes #63
2015-10-15 18:53:55 +01:00
Le Lan Johan
c486e8f25b
Do not force two slashes for uris
...
To allow relative urls (conformed to https://tools.ietf.org/html/rfc1808 ), URI regex do not force two slashes after scheme.
2015-10-14 09:52:28 +02:00
Evgeny Poberezkin
e02972207c
validate "required" properties within "properties" keyword, closes #41
2015-10-11 00:08:58 +01:00
Evgeny Poberezkin
80dc982d59
replaced Array functions with for loop, added ajv instances to tests
2015-10-10 20:50:57 +01:00
Evgeny Poberezkin
738e343ccf
fixed reference resolution when multiple schema files are compiled, closes #50 , closes #53
2015-10-02 22:06:00 +01:00
Marc MacLeod
71e8ff3f2c
update the required message rather than dataPath
2015-09-26 12:11:20 -05:00
Marc MacLeod
f024918133
remove redundant property val in error message
...
For required properties, the error message is currently:
"data.name should have required property .name"
This works for other validations, where the property is present, but required is a special case that indicates the property is not there. The above message is somewhat confusing. I've simply updated the required errors to read:
"data should have required property .name"
2015-09-25 15:18:17 -05:00
Evgeny Poberezkin
a67b661e10
fixed #52 (compileAsync); loadSchema should be called only once for any schema; error is always passed via callback
2015-09-23 23:42:33 +01:00
Evgeny Poberezkin
d6ed06766c
fixed #48 - indices in dataPath in error messages for items keyword
2015-09-23 21:58:19 +01:00
Evgeny Poberezkin
de3d3469fe
fixed #51 (compileAsync); ensure that callback in compileAsync is always called asynchronously
2015-09-23 21:04:34 +01:00
Evgeny Poberezkin
f23deffff3
update text returned by errorsText method
2015-09-22 22:47:54 +01:00
Evgeny Poberezkin
34993de951
i18n support for ajv-i18n package
2015-09-13 01:01:20 +01:00
Evgeny Poberezkin
6723287c3e
optimized equal
2015-09-07 09:58:33 +01:00
Yury Chebotaev
de02d4d8ab
Compare objects with better approach by @blakeembrey that not count order of keys
2015-09-07 03:45:10 +05:00
Yury Chebotaev
1b0a471448
equal fail when order of keys is different
2015-09-07 02:58:01 +05:00
Evgeny Poberezkin
fe097794a9
asynchronous schema compilation with loading missing remote schemas using supplied function, #43 , mulesoft-labs/osprey-mock-service#11
2015-09-03 00:17:50 +01:00
Evgeny Poberezkin
bec34c5ba5
error thrown in case of missing reference has properties missingRef and missingSchema, related to #43 , mulesoft-labs/osprey-mock-service#11
2015-09-02 18:20:43 +01:00
Evgeny Poberezkin
ed7c14801d
jshint, closes #34
2015-08-27 20:55:44 +01:00
Evgeny Poberezkin
d99e707a69
improved performance of "properties" keyword; schema tests for 64 options combinations
2015-08-24 00:40:27 +01:00
Evgeny Poberezkin
cc8de5bb8e
tests for inlined schemas, #6
2015-08-23 21:17:11 +01:00
Evgeny Poberezkin
69bc41a38c
optimised access to compiled/inlined referenced schemas
2015-08-23 13:27:05 +01:00
Evgeny Poberezkin
f3b65f4a58
Merge branch 'master' into inline
2015-08-23 12:04:38 +01:00
Evgeny Poberezkin
843557e03f
optimised regexps to create them during compile time, reuse regexp instances
2015-08-22 23:57:16 +01:00
Evgeny Poberezkin
1c508fa98c
removed compiled dot templates from the repo, #34
2015-08-22 22:17:07 +01:00
Evgeny Poberezkin
f9017a54d3
dataPath using jsonPointers in "required" keyword when allErrors == false, #32
2015-08-22 21:58:38 +01:00
Evgeny Poberezkin
4c4fdd5afc
optimised getExprPath for numbers (items keyword), #32
2015-08-22 21:21:18 +01:00
Evgeny Poberezkin
00419a120e
Merge pull request #36 from blakeembrey/json-pointers
...
Support JSON pointers
2015-08-22 20:23:55 +01:00
Blake Embrey
e6da675f91
Support JSON pointers
2015-08-22 11:52:05 -07:00
Evgeny Poberezkin
7f37f1b546
removed hyper meta-schema, same schema is used as latest meta-schema
2015-08-21 23:11:18 +01:00
Evgeny Poberezkin
d8d59ed352
inline refs with all keywords but "$ref"
2015-08-21 22:52:29 +01:00
Blake Embrey
4989662947
Add latest meta schemas according to schema spec
2015-08-21 10:14:36 -07:00
Evgeny Poberezkin
7d0c6d1d25
inline simple refs, #6
2015-08-19 22:54:05 +01:00
Evgeny Poberezkin
cfec9e3fb3
removed unused it.dataPath, related to #32
2015-08-19 00:31:19 +01:00
Evgeny Poberezkin
e74f79eea6
removed unused code with _debug option
2015-08-19 00:22:05 +01:00
Evgeny Poberezkin
8abbf63e9b
Merge branch 'master' into 1.0.0
2015-08-16 23:00:43 +01:00
Evgeny Poberezkin
982cfab809
removed unused code
2015-08-16 02:11:00 +01:00
Evgeny Poberezkin
704fb11c1d
optimized not rule
2015-08-16 01:21:35 +01:00
Evgeny Poberezkin
286368fb23
optimized required rule compilation
2015-08-16 01:10:43 +01:00
Evgeny Poberezkin
dfd6de5857
removed _debug option
2015-08-16 00:59:28 +01:00
Evgeny Poberezkin
fe53458a6e
missingRefs option tests
2015-08-15 23:59:14 +01:00
Evgeny Poberezkin
87cc09501b
tests: options, format regex
2015-08-12 01:00:46 +01:00
Evgeny Poberezkin
c4fb165f8d
simplified util.toHash
2015-08-11 22:52:34 +01:00
Evgeny Poberezkin
eeb1307448
jshint "validthis" option
2015-08-11 19:24:31 +01:00
Evgeny Poberezkin
a3be10e40d
.jshintrc: node, allow ==
2015-08-11 19:13:08 +01:00
Evgeny Poberezkin
1a1353717b
.jshintrc, code style
2015-08-11 19:06:32 +01:00
Evgeny Poberezkin
dfa640a1b2
readme, fixed addMetaSchema
2015-08-09 12:49:05 +01:00
Evgeny Poberezkin
22d4c6e40d
addSchema no longer returns compiled schema
2015-08-09 11:46:44 +01:00
Evgeny Poberezkin
0012b09ccf
do not replace schema object with compiled function
2015-08-09 00:54:06 +01:00
Evgeny Poberezkin
c175259b48
clean up resolve
2015-08-08 20:57:50 +01:00
Evgeny Poberezkin
234729121f
Merge branch 'master' into 1.0.0
2015-08-08 19:39:27 +01:00
Evgeny Poberezkin
ab32638acc
addMetaSchema validates metaschema by default
2015-08-08 19:34:01 +01:00
Evgeny Poberezkin
1b8c922ebc
preserve roots during ref resolution, closes #27
2015-08-08 19:06:51 +01:00
Evgeny Poberezkin
41ed37f36f
resolves recursive schema issue #27 , breaks test for issue #13 , raml schema has regex issue
2015-08-08 12:21:41 +01:00
Evgeny Poberezkin
9466859f92
addMetaSchema method, closes #26
2015-08-08 10:56:19 +01:00
Evgeny Poberezkin
22513f598a
Merge branch 'master' into 1.0.0
2015-08-07 23:17:06 +01:00
Evgeny Poberezkin
a0c342c58f
fixed resolving recursive references, closes issue #27
2015-08-07 01:54:07 +01:00
Evgeny Poberezkin
bde23cbe9e
removed type escaping in errors
2015-08-07 00:14:08 +01:00
Blake Embrey
b7877a2dcf
Compile dot templates
2015-08-06 14:47:17 -07:00
Blake Embrey
2a8ce631dd
Escape everything else that might need escaping
2015-08-06 14:47:17 -07:00
Blake Embrey
02d6a5431d
Escape schema strings in output
2015-08-06 14:29:45 -07:00
Evgeny Poberezkin
021b20a366
fixed removeAdditional/validateSchema
2015-07-31 21:00:44 +01:00
Evgeny Poberezkin
94f51e1248
Merge branch 'master' into 1.0.0
2015-07-31 20:06:43 +01:00
Evgeny Poberezkin
62adbbe1ed
fixed removeAdditional, tests, added "failing" for removeAdditional; closes #25 , related to #23
2015-07-31 19:23:35 +01:00
Evgeny Poberezkin
23bf0ac5fb
option removeAdditional equal to "all"
2015-07-30 09:22:15 +01:00
Evgeny Poberezkin
232a7aeb49
option removeAdditional equal to "all"
2015-07-30 09:21:36 +01:00
Evgeny Poberezkin
36085debf5
indentations
2015-07-30 09:06:31 +01:00
Andy Scott
cff345ae16
Move `removeAdditional` option out of shared definitions
2015-07-29 09:56:57 -07:00
Andy Scott
94ddac2bc9
Add test for options (just `removeAdditional`, for now)
2015-07-29 09:56:11 -07:00
Andy Scott
d5ed4403b8
During validation allow flag to remove values flagged by `additionalProperties: false`
2015-07-28 16:34:46 -07:00
Evgeny Poberezkin
be023eda11
Merge branch 'master' into 1.0.0
2015-07-26 10:37:56 +01:00
Evgeny Poberezkin
6c93d0346d
fixed "required" with properties that are not identifiers, closes #20
2015-07-22 16:26:28 +01:00
Evgeny Poberezkin
32ee26ec94
readme: supported formats
2015-07-21 22:36:20 +01:00
Evgeny Poberezkin
af46a38428
fixed required for inner level with many properties, closes #19
2015-07-20 17:41:06 +01:00
Evgeny Poberezkin
9b1361c92e
readme, removed unused code
2015-07-04 01:58:08 +01:00
Evgeny Poberezkin
8a5d8f32b7
fixed losing errors when validating mutually recursive schemas, #5
2015-07-04 01:37:35 +01:00
Evgeny Poberezkin
5641185396
adding schemas without compiling them, support for recursive schemas, adding dependencies in any order, #5
2015-07-04 00:48:32 +01:00
Evgeny Poberezkin
5416eaf86d
improved error messages for "required" keyword, closes #18
2015-07-01 00:30:57 +01:00
Evgeny Poberezkin
5fc0b18287
improved error reporting for "required" keyword with large size schema, #18
2015-06-30 22:26:00 +01:00
Evgeny Poberezkin
22cdf02e51
improved error reporting for "required" keyword with limited size schema, #18
2015-06-30 22:09:14 +01:00
Evgeny Poberezkin
1cbcade81f
fixed #1 IDs in refs without root id
2015-06-24 01:28:40 +01:00
Evgeny Poberezkin
e7b0ee76e2
do not create global (instance level) refs for IDs that start from #
2015-06-24 00:55:38 +01:00
Evgeny Poberezkin
0ccf7e73f1
use properties as properties or indeces correctly in all cases
2015-06-24 00:43:52 +01:00
Evgeny Poberezkin
391d60482c
fixed escaping pattern property ( fixes #17 )
2015-06-23 17:26:03 +01:00
Evgeny Poberezkin
853ed64bf9
prevent including js-beautify in the browser
2015-06-22 14:40:25 +01:00
Evgeny Poberezkin
a97e6740e7
removeSchema method, closes #8
2015-06-20 18:41:56 +01:00
Evgeny Poberezkin
b16989f779
cache option to change the way the schemas are cached, issue #8
2015-06-20 15:37:29 +01:00
Evgeny Poberezkin
4e1f0e54c4
prevent possible issues like #13
2015-06-19 00:59:53 +01:00
Evgeny Poberezkin
cbdd00e9c6
fixed #13 - root ref in remote ref
2015-06-19 00:57:19 +01:00
Evgeny Poberezkin
8bfb3f9b4a
added anyOf error, refactored test
2015-06-18 23:01:39 +01:00
Evgeny Poberezkin
46812e0ac6
fixed #14 : remote ref in definitions in remote ref with ids
2015-06-18 20:48:35 +01:00
Evgeny Poberezkin
123aa99b15
test for #13
2015-06-18 15:01:15 +01:00
Evgeny Poberezkin
a285b060ab
option schemas added to readme
2015-06-18 08:13:39 +01:00
Evgeny Poberezkin
5b2ba08813
missingRefs option - "ignore", "fail" or throw error during compilation (default)
2015-06-17 22:23:49 +01:00
Evgeny Poberezkin
2ae8c89708
allow uri and throw on error when validating schemas against meta-schema
2015-06-17 22:06:07 +01:00
Evgeny Poberezkin
9931223dd9
list rules requires explicitely to make browserify work
2015-06-17 15:52:24 +01:00
Evgeny Poberezkin
5f36f17f63
precompiled dot templates, dot is devDependency, closes #3
2015-06-17 14:42:13 +01:00
Evgeny Poberezkin
5b434b426e
validate schema against meta-schema
2015-06-17 02:05:52 +01:00
Evgeny Poberezkin
08c8032fe1
include property in error.dataPath for additionalProperty, closes #11
2015-06-16 22:54:08 +01:00
Evgeny Poberezkin
0576ea986e
removed unused code
2015-06-16 22:19:26 +01:00
Evgeny Poberezkin
f19f7fdedf
refactor $ref.dot
2015-06-16 22:04:17 +01:00
Evgeny Poberezkin
058fcfb5cb
fixed ref resolution using wrong root when compiling resolved schema
2015-06-16 18:14:24 +01:00
Evgeny Poberezkin
e0d6afe7dc
evgeny, jason: fixed incorrect root replacing and failure to resolve ref to another file root from inside ref, closes #12
2015-06-16 17:10:27 +01:00
Evgeny Poberezkin
082284d9cc
fixed incorrect resolution of root ref in ref, fixes #2
2015-06-16 15:11:33 +01:00