You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the underlying problem you're trying to solve?
Type checking can be improved with schemas, it's very cool. Right now Rego only does type checking when accessing an object and its child properties that are associated with a schema. But type checking stops working in other very common cases:
assigning an object property to a variable
passing an object to a Rego function
passing an object to a custom function
Describe the ideal solution
The type is stored in the value and are used for type checking anywhere
Additional Context
In the example below, only the first case works.
Example Rego file:
package test
import rego.v1
deny if {
# case 1
input.foo.baz
# case 2# foo := input.foo# foo.baz# case 3# test(input.foo)# case 4# object.get(input.foo, "baz", input.foo)
}
test(foo) if foo.baz
What is the underlying problem you're trying to solve?
Type checking can be improved with schemas, it's very cool. Right now Rego only does type checking when accessing an object and its child properties that are associated with a schema. But type checking stops working in other very common cases:
Describe the ideal solution
The type is stored in the value and are used for type checking anywhere
Additional Context
In the example below, only the first case works.
Example Rego file:
schema.json
input.json
{ "foo": {} }
Run
opa eval data -d test.rego -i input.json -s schema.json
The text was updated successfully, but these errors were encountered: