karenetheridge / JSON-Schema-Modern

Validate data against a schema using a JSON Schema
https://metacpan.org/release/JSON-Schema-Modern/
Other
10 stars 1 forks source link

implement validator keywords #1

Closed karenetheridge closed 4 years ago

karenetheridge commented 4 years ago

https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6

karenetheridge commented 4 years ago

Note for comparisons made with 'enum' and 'const': numbers must be compared mathematically, not strings-compare-as-identical-when-json-encoded (https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.3). The difference will become apparent when comparing {"value":1.0} to {"value":1}.

karenetheridge commented 4 years ago

Make sure that bad regexes in 'pattern' are handled. Also be aware of security issues -- do not allow access to local variables etc.

karenetheridge commented 4 years ago

This is complete as of today, to be released in version 0.001.

# Results using Test::JSON::Schema::Acceptance 0.993
# with commit 9d0e0eb31d6be6bebd3bacdd6be119a8841e9999 (2.0.0-172-g9d0e0eb)
# from git://github.com/json-schema-org/JSON-Schema-Test-Suite.git:
# 
# filename                    pass  fail
# --------------------------------------
# additionalItems.json           9     0
# additionalProperties.json     15     0
# allOf.json                    22     0
# anchor.json                    3     3
# anyOf.json                    18     0
# boolean_schema.json           18     0
# const.json                    36     0
# contains.json                 13     0
# default.json                   4     0
# defs.json                      1     1
# dependentRequired.json        20     0
# dependentSchemas.json         13     0
# enum.json                     29     0
# exclusiveMaximum.json          4     0
# exclusiveMinimum.json          4     0
# format.json                  102     0
# if-then-else.json             18     0
# items.json                    23     3
# maxItems.json                  4     0
# maxLength.json                 5     0
# maxProperties.json             6     0
# maximum.json                   8     0
# minItems.json                  4     0
# minLength.json                 5     0
# minProperties.json             6     0
# minimum.json                  11     0
# multipleOf.json                8     0
# not.json                      12     0
# oneOf.json                    27     0
# pattern.json                   9     0
# patternProperties.json        21     0
# properties.json               20     0
# propertyNames.json            10     0
# ref.json                      17    13
# refRemote.json                 8     7
# required.json                  9     0
# type.json                     80     0
# unevaluatedItems.json          0    32
# unevaluatedProperties.json     0    38
# uniqueItems.json              56     0