Replies: 7 comments 4 replies
-
Well this will be the reason: https://github.com/api-platform/laravel/blob/v4.0.17/ApiPlatformProvider.php#L842 |
Beta Was this translation helpful? Give feedback.
-
I guess my questions is: are filters not implemented within the Laravel implementation for usage on a resource or operation? |
Beta Was this translation helpful? Give feedback.
-
can you show some code? filters are declared using the |
Beta Was this translation helpful? Give feedback.
-
@soyuka - it’s adding filters to an ApiResource globally, or to a specific resource operation, I.e. Get. I’m using Filters within QueryParameters and that’s fine, but adding them as mentioned above means they do not get processed, and furthermore, breaks the documentation. If you simply add a filter to an ApiResource whilst using a default Laravel install, and try to use the documentation (and/or utilise the global filter), you’ll see the issues. |
Beta Was this translation helpful? Give feedback.
-
show some code please I don't understand what you're trying to do |
Beta Was this translation helpful? Give feedback.
-
Sure, so I need to have the following within a Laravel Model
This is because I want to apply a filter to all requests to this endpoint, regardless. I know I can do the following:
But this filter is only triggered when the |
Beta Was this translation helpful? Give feedback.
-
A filter is always linked to a parameter, for this you need to use query extensions ( core/src/Laravel/ApiPlatformProvider.php Lines 440 to 447 in ad54075 An example is our A more even more powerful solution is to use a |
Beta Was this translation helpful? Give feedback.
-
API Platform version(s) affected:4.0.17
Description
When a filter is added to either an
ApiResource
, or aOperation
such asGetCollection
, the Swagger documentation fails on the following error:Furthermore, hitting the endpoint not via the documentation, i.e. using
application/json
, doesn't trigger the error, but it also does not fire the Filter as is expected.Beta Was this translation helpful? Give feedback.
All reactions