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

[feature request]: filter on "truthyness" #30

Open
abeforgit opened this issue Jul 13, 2023 · 0 comments
Open

[feature request]: filter on "truthyness" #30

abeforgit opened this issue Jul 13, 2023 · 0 comments

Comments

@abeforgit
Copy link

In linked data, fundamentally the absence of a true value does not necessarily mean false.
However in practice, they do overlap often (i.e. the frontend needs to handle them in the same way)

As of right now, it is possible to achieve this for booleans with:

      this.store.query('versioned-behandeling', {
        'filter[zitting][:id:]': meetingId,
        'filter[:or:][deleted]': false,
        'filter[:or:][:has-no:deleted]': false,
      }),

This is a bit cumbersome, and the mistake of forgetting to check for the "null case" is easily made.

I'd propose a search modifier:

filter[:truthy:property]: false

which handles the null case with absence of value being treated as false.

Theres various discussions that can be had about what values should be considered truthy, but I'd propose a conservative "any existing value that is not explicitly the boolean "false""

with "boolean" here being defined as "whatever gets serialized to a json boolean in the response"

It could also be made configurable to consider things like numerical 0 or the empty string as falsy, but that might make it more difficult to understand stacks that have a different config that one is used to.

Another option is to follow truthyness rules from javascript, which people are most familiar with.

But this issue is at least the start of discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant