3 Commits

Author SHA1 Message Date
Anders Eknert a49e17eabd JSON schema: skip pattern attribute compilation (#4429)
We don't use the regex "pattern" attribute for type checking,
but this still caused problems parsing schemas where the pattern
specified contained things that the Go regex dialect did not
support, such as negative lookahead. Solved for now by simply
removing the regex compilation of pattern properties.

Fixes #4426

Signed-off-by: Anders Eknert <anders@eknert.com>
2022-03-11 11:31:48 +01:00
Olivier Lemasle 123ba6b841 internal/gojsonschema: fix test failing with Go 1.17 rc (#3591)
Replace the time "01:01:01,1111" by "14:30", which is a ISO 8601 valid time,
but not a RFC3339 "full time", and is rejected as such by the TimeFormatChecker.

Fixes #3589

Signed-off-by: Olivier Lemasle <o.lemasle@gmail.com>
2021-06-28 21:59:43 +02:00
Ansu Varghese cc1cecf567 opa eval: support rego validation using input JSON schema (#3060)
New support to input a JSON schema file via "opa eval --schema" that
helps improve static type checking and returns precise error reports as
you develop Rego code.

Also, uses modified version of https://github.com/xeipuuv/gojsonschema
from internal/ to help set Rego types, using gojsonschema's Compiler
results. See README docs for more details on the feature.

Co-authored-by: Mandana Vaziri <mvaziri@us.ibm.com>
Co-authored-by: Ansu Varghese <avarghese@us.ibm.com>
Signed-off-by: Ansu Varghese <avarghese@us.ibm.com>
2021-01-27 13:32:59 +01:00