Skip to content

Support for filtering on nested fields #155

@kiptoomm

Description

@kiptoomm

I was looking at the sample filtering docs.

If I had my PersonSchema using fields.Nested instead of fields.Relationships, like this:

class PersonSchema(Schema):
    ...
    computers = fields.Nested(ComputerSchema, exclude=('person',))
    ...

How can I perform filtering with a call similar to the one provided in the sample?

For me, GET /persons?filter=[ { "name": "computers", "op": "any", "val": { "name": "serial", "op": "ilike", "val": "%Amstrad%" } } ] HTTP/1.1 Accept: application/vnd.api+json

leads to an error like so:

{
detail: "PersonSchema has no relationship attribute computers",
status: "400",
title: "Invalid filters querystring parameter."
}

Will appreciate any ideas. I'm migrating from flask-restless and would much prefer to keep using nested fields as opposed to relationships to preserve the way my current API clients work

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