Skip to content

Invalid filter comparison parameters do not generate InvalidRequest #78

@tjchambers

Description

@tjchambers

By experimentation I have determined that an invalid filter comparison parameter is ignored without warning. The result is that the filter that was intended is not applied without notice to the client.

Example:

c = BlockScore::Person.all('create_at[gt]' => Time.now.to_i+1)

should in fact return an empty array. However it returns most recent 25 Persons because the create_at should be created_at. This could leave the impression that interface code is working when in fact it is NOT.

Note that this is in contrast to mistyping the actual comparison operator:

c = BlockScore::Person.all('created_at[gtx]' => Time.now.to_i+1)
BlockScore::InvalidRequestError: (Type: invalid_request_error) Received unknown filter directive: gtx (gtx) (Status: 400)

which DOES return a suitable message.

...and in contrast to bad filter parameters

c = BlockScore::Person.all('filter[name_second]' => 'valid')
BlockScore::InvalidRequestError: (Type: invalid_request_error) Received unknown filter parameter: name_second (name_second) (Status: 400)

which are acknowledged as invalid properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions