Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong message in runtime type check for count, object.filter and object remove #4767

Closed
anderseknert opened this issue Jun 10, 2022 · 0 comments · Fixed by #4768
Closed

Wrong message in runtime type check for count, object.filter and object remove #4767

anderseknert opened this issue Jun 10, 2022 · 0 comments · Fixed by #4768
Labels

Comments

@anderseknert
Copy link
Member

anderseknert commented Jun 10, 2022

❯ echo '{"x":true}' | opa eval -I -f pretty --strict-builtin-errors 'object.remove({"a": 1}, input.x)'

eval_type_error: object.remove: operand 2 must be one of {object, string, array} but got boolean

These functions do not accept string — that should be a set instead. Funny how we have 8 tests that assert this exact message, and nobody noticed!

The best test case was this one:

expected topdown error text "object.remove: operand 2 must be one of {object, string, array} but got string"

😄

EDIT: Also found this in count, so fixing there as well.

anderseknert added a commit to anderseknert/opa that referenced this issue Jun 10, 2022
Fixes open-policy-agent#4767

Signed-off-by: Anders Eknert <anders@eknert.com>
@anderseknert anderseknert changed the title Wrong error message in type error for object.filter and object remove Wrong message in runtime type check for count, object.filter and object remove Jun 10, 2022
anderseknert added a commit that referenced this issue Jun 10, 2022
…remove (#4768)

Fixes #4767

Signed-off-by: Anders Eknert <anders@eknert.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant