build(deps): bump github.com/open-policy-agent/opa from 1.10.1 to 1.11.0
Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 1.10.1 to 1.11.0. - [Release notes](https://github.com/open-policy-agent/opa/releases) - [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-policy-agent/opa/compare/v1.10.1...v1.11.0) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-version: 1.11.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
5ed944dfc3
commit
82c82f8ae2
+3
@@ -39,5 +39,8 @@ type Directive struct {
|
||||
}
|
||||
|
||||
func (d *Directive) ArgumentMap(vars map[string]interface{}) map[string]interface{} {
|
||||
if d.Definition == nil {
|
||||
return nil
|
||||
}
|
||||
return arg2map(d.Definition.Arguments, d.Arguments, vars)
|
||||
}
|
||||
|
||||
+3
@@ -37,5 +37,8 @@ type Argument struct {
|
||||
}
|
||||
|
||||
func (f *Field) ArgumentMap(vars map[string]interface{}) map[string]interface{} {
|
||||
if f.Definition == nil {
|
||||
return nil
|
||||
}
|
||||
return arg2map(f.Definition.Arguments, f.Arguments, vars)
|
||||
}
|
||||
|
||||
+4
-3
@@ -29,9 +29,10 @@ type Value struct {
|
||||
Comment *CommentGroup
|
||||
|
||||
// Require validation
|
||||
Definition *Definition
|
||||
VariableDefinition *VariableDefinition
|
||||
ExpectedType *Type
|
||||
Definition *Definition
|
||||
VariableDefinition *VariableDefinition
|
||||
ExpectedType *Type
|
||||
ExpectedTypeHasDefault bool
|
||||
}
|
||||
|
||||
type ChildValue struct {
|
||||
|
||||
+2
@@ -182,6 +182,7 @@ func (w *Walker) walkValue(value *ast.Value) {
|
||||
fieldDef := value.Definition.Fields.ForName(child.Name)
|
||||
if fieldDef != nil {
|
||||
child.Value.ExpectedType = fieldDef.Type
|
||||
child.Value.ExpectedTypeHasDefault = fieldDef.DefaultValue != nil && fieldDef.DefaultValue.Kind != ast.NullValue
|
||||
child.Value.Definition = w.Schema.Types[fieldDef.Type.Name()]
|
||||
}
|
||||
}
|
||||
@@ -208,6 +209,7 @@ func (w *Walker) walkValue(value *ast.Value) {
|
||||
func (w *Walker) walkArgument(argDef *ast.ArgumentDefinition, arg *ast.Argument) {
|
||||
if argDef != nil {
|
||||
arg.Value.ExpectedType = argDef.Type
|
||||
arg.Value.ExpectedTypeHasDefault = argDef.DefaultValue != nil && argDef.DefaultValue.Kind != ast.NullValue
|
||||
arg.Value.Definition = w.Schema.Types[argDef.Type.Name()]
|
||||
}
|
||||
|
||||
|
||||
+8
-1
@@ -77,6 +77,7 @@ func (r *Rules) AddRule(name string, ruleFunc core.RuleFunc) {
|
||||
|
||||
// GetInner returns the internal rule map.
|
||||
// If the map is not initialized, it returns an empty map.
|
||||
// This returns a copy of the rules map, not the original map.
|
||||
func (r *Rules) GetInner() map[string]core.RuleFunc {
|
||||
if r == nil {
|
||||
return nil // impossible nonsense, hopefully
|
||||
@@ -84,7 +85,13 @@ func (r *Rules) GetInner() map[string]core.RuleFunc {
|
||||
if r.rules == nil {
|
||||
return make(map[string]core.RuleFunc)
|
||||
}
|
||||
return r.rules
|
||||
|
||||
rules := make(map[string]core.RuleFunc)
|
||||
for k, v := range r.rules {
|
||||
rules[k] = v
|
||||
}
|
||||
|
||||
return rules
|
||||
}
|
||||
|
||||
// RemoveRule removes a rule with the specified name from the rule set.
|
||||
|
||||
Generated
Vendored
+5
@@ -25,6 +25,11 @@ var VariablesInAllowedPositionRule = Rule{
|
||||
}
|
||||
}
|
||||
|
||||
// If the expected type has a default, the given variable can be null
|
||||
if value.ExpectedTypeHasDefault {
|
||||
tmp.NonNull = false
|
||||
}
|
||||
|
||||
if !value.VariableDefinition.Type.IsCompatible(&tmp) {
|
||||
addError(
|
||||
Message(
|
||||
|
||||
Reference in New Issue
Block a user