core icon indicating copy to clipboard operation
core copied to clipboard

GraphQL Fix: Apply filters to collection queries

Open masonmcelvain opened this issue 3 years ago • 4 comments

Q A
Branch? 2.6
Tickets https://github.com/api-platform/core/issues/4615
License MIT
Doc PR none, bug fix

Problem

Custom filters extending ApiPlatform\Core\Serializer\Filter\FilterInterface are applied in REST but not GraphQL when using a custom data provider (i.e. not Doctrine). Specifically, the FilterInterface::apply() method does not seem to be called.

Fix

Adds code to collect the filters in GraphQL similar to how they are collected in REST and call the apply() method of each filter.

Closes https://github.com/api-platform/core/issues/4615

masonmcelvain avatar Jan 26 '22 20:01 masonmcelvain

@alanpoulain @lukasluecke @ollietb Sorry to bother but I would appreciate some quick feedback on this PR. It's been about a month now.

masonmcelvain avatar Feb 28 '22 16:02 masonmcelvain

Hello, Sorry for this. I will try to review the pending PR when API Platform 2.7/3 is out. Merging PR in our current state creates a lot of burden for maintainers.

alanpoulain avatar Feb 28 '22 16:02 alanpoulain

@alanpoulain @lukasluecke @ollietb please take another look at this. This fixes a major bug in a core feature of api-platform's graphql support. The next release really shouldn't go out without this fix if you are claiming to support graphql. My team is in the middle of implementing api-platform, which we chose for its graphql support, but our project is currently stalled on this bug. Thanks for your time and your effort on this project.

sterlinghirsh avatar Mar 25 '22 22:03 sterlinghirsh

I think the test failures are unrelated, given that other PR's for 2.6 seem to be failing them as well (e.g. https://github.com/api-platform/core/pull/4762)

masonmcelvain avatar May 23 '22 17:05 masonmcelvain

Closing because https://github.com/api-platform/core/issues/4615 is resolved

masonmcelvain avatar Oct 20 '22 15:10 masonmcelvain