And enable the `tenv` linter for the future.
Also, bump version of golangci-lint and fix some new
warnings that came from that.
Signed-off-by: Anders Eknert <anders@eknert.com>
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>
Currently OPA's schema checker does not support allOf. This commit parses allOf by merging all the subschemas into a single schema before converting to a Rego type. I also included a short explanation in schemas.md.
Fixes: open-policy-agent#3592
Signed-off-by: Julia Friedman <juliafriedman@ibm.com>
Currently OPA’s schema checker does not support features like
anyOf and allOf. This commit parses anyOf using types.Any because
anyOf can be implemented by an Or type. I also included a
short explanation in schemas.md.
Related to: #3592
Signed-off-by: Jing Chen <jing.10500@gmail.com>
This commit fixes the conversion to treat array.items schema as the
dynamic element type in arrays as opposed to the static element
type. If array.items is defined as an object then it applies to ALL
elements in the array. On the other hand, if array.items is defined as
an array then it applies pairwise to the elements in the array.
In order to fix this, we have to expose a new field from the schema library.
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
golint is deprecated. The author of the code no longer supports the
codebase. golangci-lint is faster than golint, and is in use by other
opa repositories (e.g. Gatekeeper).
This commit changes tools.go to reference golangci (so it ends up in
vendor) and modifies check-lint to use golangci instead.
Breaking API Changes:
- plugins/rest/rest.go: Fix typo "AllowInsureTLS" -> "AllowInsecureTLS"
- storage/errors.go: Removed unused IndexingNotSupportedErr
Signed-off-by: Will Beason <willbeason@google.com>
These were written before type checking and map handling in Go was
standardized. This PR updates the copied library to use more modern
conventions.
Signed-off-by: Will Beason <willbeason@google.com>
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>