diff --git a/builtin_metadata.json b/builtin_metadata.json index a85c67e4be..57df28b8c7 100644 --- a/builtin_metadata.json +++ b/builtin_metadata.json @@ -22140,7 +22140,7 @@ "v1.19.0", "edge" ], - "description": "Matches a string against a pattern, where there pattern may be glob-like", + "description": "Matches a string against a pattern, where the pattern may be glob-like", "introduced": "v0.17.0", "result": { "description": "true if `value` matches the `template`", @@ -26739,7 +26739,7 @@ "args": [ { "description": "value to convert", - "name": "x", + "name": "value", "type": "any\u003cnull, boolean, number, string\u003e" } ], @@ -26891,10 +26891,10 @@ "v1.19.0", "edge" ], - "description": "Converts a string, bool, or number value to a number: Strings are converted to numbers using `strconv.Atoi`, Boolean `false` is converted to 0 and `true` is converted to 1.", + "description": "Converts value of type string, null or boolean to number. Numeric strings converts to the corresponding number when possible. Null and boolean `false` converts to 0 and boolean `true` to 1. Numbers are returned without conversion.", "introduced": "v0.17.0", "result": { - "description": "the numeric representation of `x`", + "description": "the numeric representation of `value`", "name": "num", "type": "number" }, diff --git a/v1/ast/builtins.go b/v1/ast/builtins.go index 17ed06035d..ece3575c71 100644 --- a/v1/ast/builtins.go +++ b/v1/ast/builtins.go @@ -941,18 +941,20 @@ var ArrayReverse = &Builtin{ var conversions = category("conversions") var ToNumber = &Builtin{ - Name: "to_number", - Description: "Converts a string, bool, or number value to a number: Strings are converted to numbers using `strconv.Atoi`, Boolean `false` is converted to 0 and `true` is converted to 1.", + Name: "to_number", + Description: "Converts value of type string, null or boolean to number. Numeric strings converts to the " + + "corresponding number when possible. Null and boolean `false` converts to 0 and boolean `true` to 1. " + + "Numbers are returned without conversion.", Decl: types.NewFunction( types.Args( - types.Named("x", types.NewAny( + types.Named("value", types.NewAny( types.N, types.S, types.B, types.Nl, )).Description("value to convert"), ), - types.Named("num", types.N).Description("the numeric representation of `x`"), + types.Named("num", types.N).Description("the numeric representation of `value`"), ), Categories: conversions, CanSkipBctx: true, @@ -1002,7 +1004,7 @@ var RegexFindAllStringSubmatch = &Builtin{ var RegexTemplateMatch = &Builtin{ Name: "regex.template_match", - Description: "Matches a string against a pattern, where there pattern may be glob-like", + Description: "Matches a string against a pattern, where the pattern may be glob-like", Decl: types.NewFunction( types.Args( types.Named("template", types.S).Description("template expression containing `0..n` regular expressions"), diff --git a/v1/bundle/store.go b/v1/bundle/store.go index 1784c98f5f..a753896cb4 100644 --- a/v1/bundle/store.go +++ b/v1/bundle/store.go @@ -528,7 +528,7 @@ func activateBundles(opts *ActivateOpts) error { } // Compile the modules all at once to avoid having to re-do work. - remainingAndExtra := make(map[string]*ast.Module) + remainingAndExtra := make(map[string]*ast.Module, len(remaining)+len(opts.ExtraModules)) maps.Copy(remainingAndExtra, remaining) maps.Copy(remainingAndExtra, opts.ExtraModules) @@ -994,7 +994,7 @@ func compileModules(compiler *ast.Compiler, m metrics.Metrics, bundles map[strin return compiler.Errors } - if authorizationDecisionRef.Equal(ast.EmptyRef()) { + if authorizationDecisionRef.Equal(ast.InternedEmptyRefValue) { return nil } diff --git a/v1/doc.go b/v1/doc.go index b4991633ba..26e23137d4 100644 --- a/v1/doc.go +++ b/v1/doc.go @@ -5,5 +5,5 @@ // Package v1 implements the v1 API for the Open Policy Agent (OPA). // The v1 API defaults to enforcing the v1 Rego syntax ([github.com/open-policy-agent/opa/v1/ast.RegoV1]). // Most packages outside the v1 API are deprecated. These constitute the older v0 API, which defaults to the v0 Rego syntax ([github.com/open-policy-agent/opa/v1/ast.RegoV0]). -// The v0 API is provided as a means to ease transition to OPA 1.0 for 3rd party integrations, see [TODO: LINK TO V0 MIGRATION GUIDE]. +// The v0 API is provided as a means to ease transition to OPA 1.0 for 3rd party integrations. For more information, see https://www.openpolicyagent.org/docs/v0-upgrade. package v1