Replies: 7 comments 4 replies
|
Well this will be the reason: https://github.com/api-platform/laravel/blob/v4.0.17/ApiPlatformProvider.php#L842 |
|
I guess my questions is: are filters not implemented within the Laravel implementation for usage on a resource or operation? |
|
can you show some code? filters are declared using the |
|
@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. |
|
show some code please I don't understand what you're trying to do |
|
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 |
|
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 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
API Platform version(s) affected:4.0.17
Description
When a filter is added to either an
ApiResource, or aOperationsuch 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.All reactions