aspect-build / bazel-lib

Common useful functions for writing BUILD files and Starlark macros/rules

Home Page:https://docs.aspect.build/rules/aspect_bazel_lib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FR]: Support `filter_file` in `assert_json_matches`

ARR4N opened this issue · comments

What is the current behavior?

Only string-literal filters can be passed to assert_json_matches, but jq() supports using files.

Describe the feature

Change the signature to:

assert_json_matches(name, file1, file2, filter1 = ".", filter2 = ".", filter_file1 = None, filter_file2 = None, **kwargs):

I'm happy to send a PR if you'd like; please assign the Issue to me if you agree that this is a worthwhile feature.

One problem will be incompatibility between the filter and filter_file args. Thoughts on having filter_file override filter i.f.f. filter == "."? This maintains backwards compatibility while avoiding ambiguity if both are set.

Sorry for the delay @aschlosberg - your proposal sounds good to me.