Skip to content

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

@abeforgit

Description

@abeforgit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions