infobloxopen / seal

Apache License 2.0
16 stars 11 forks source link

Add array-literal support for in-operator #138

Closed rchowinfoblox closed 1 year ago

rchowinfoblox commented 2 years ago

Also add WithInputName() method to Rego compiler

seal$ go test ./...
?       github.com/infobloxopen/seal    [no test files]
?       github.com/infobloxopen/seal/cmd        [no test files]
?       github.com/infobloxopen/seal/pkg/ast    [no test files]
?       github.com/infobloxopen/seal/pkg/compiler       [no test files]
?       github.com/infobloxopen/seal/pkg/compiler/error [no test files]
ok      github.com/infobloxopen/seal/pkg/compiler/rego  0.005s
ok      github.com/infobloxopen/seal/pkg/compiler/sql   0.006s
ok      github.com/infobloxopen/seal/pkg/compiler/test  0.073s
ok      github.com/infobloxopen/seal/pkg/lexer  0.028s
ok      github.com/infobloxopen/seal/pkg/parser 0.005s
ok      github.com/infobloxopen/seal/pkg/token  0.005s
ok      github.com/infobloxopen/seal/pkg/types  0.005s
seal$ make demo
./seal compile \
        -s docs/source/examples/petstore/petstore.jwt.swagger \
        -s docs/source/examples/petstore/petstore.tags.swagger \
        -s docs/source/examples/petstore/petstore.all.swagger \
        -f docs/source/examples/petstore/petstore.all.seal \
        > docs/source/examples/petstore/petstore.all.rego.compiled
INFO[0000] set logging format                            logging.format=text
INFO[0000] logging level                                 logging.level=info
cat docs/source/examples/petstore/petstore.all.rego.compiled
...
data.petstore.all.test_in: PASS (1.560397ms)
data.petstore.all.test_in_negative: PASS (983.942µs)
data.petstore.all.test_in_operator_array_literal_positive: PASS (1.124746ms)
data.petstore.all.test_in_operator_array_literal_negative: PASS (975.249µs)
data.petstore.all.test_not_operator_precedence_positive: PASS (1.342214ms)
data.petstore.all.test_not_operator_precedence_negative1: PASS (2.214561ms)
data.petstore.all.test_not_operator_precedence_negative2: PASS (1.278242ms)
data.petstore.all.test_not_operator_precedence_negative3: PASS (1.255446ms)
data.petstore.all.test_regexp: PASS (1.775894ms)
data.petstore.all.test_regexp_negative: PASS (1.41362ms)
data.petstore.all.test_ctx_usage_multiply: PASS (1.617005ms)
data.petstore.all.test_ctx_usage_negative_multi_ctx: PASS (1.473936ms)
data.petstore.all.test_ctx_usage_negative: PASS (1.899464ms)
data.petstore.all.test_use_tags: PASS (1.06174ms)
data.petstore.all.test_use_tags_negative: PASS (1.032344ms)
data.petstore.all.test_use_tags_negative_missing_endangered_tag: PASS (1.024921ms)
data.petstore.all.test_use_petstore_jwt: PASS (1.245419ms)
data.petstore.all.test_use_petstore_jwt_negative: PASS (1.231804ms)
data.petstore.all.test_banned_deny: PASS (2.269355ms)
data.petstore.all.test_banned_deny_negative: PASS (1.016172ms)
data.petstore.all.test_inspect: PASS (1.25188ms)
data.petstore.all.test_inspect_negative: PASS (1.105476ms)
data.petstore.all.test_read: PASS (1.483544ms)
data.petstore.all.test_read_negative: PASS (1.538968ms)
data.petstore.all.test_manage_cto: PASS (2.118699ms)
data.petstore.all.test_blank_subject: PASS (1.589954ms)
data.petstore.all.test_alphanumeric_identifiers: PASS (1.229516ms)
data.petstore.all.test_bench_deny_in_map_species: PASS (282.98µs)
data.petstore.all.test_bench_deny_in_map_species_2nd: PASS (282.193µs)
data.petstore.all.test_bench_deny_in_map_species_negative: PASS (242.085µs)
data.petstore.all.test_bench_deny_in_map_species_negative_2nd: PASS (244.511µs)
--------------------------------------------------------------------------------
PASS: 31/31
+ git diff --exit-code petstore.all.rego petstore.all.test_bench.rego petstore.all.test.rego
git diff --exit-code docs/source/examples/petstore
### petstore example passed REGO OPA tests