-
-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(laravel): add middleware granularity #6962
feat(laravel): add middleware granularity #6962
Conversation
8906f4f
to
fd58ca5
Compare
fd58ca5
to
24fd3cd
Compare
24fd3cd
to
1257699
Compare
@soyuka I still dont understand what is going on with the routing. It is behaving very strangely. First of all, I am not quite up-to-speed on the intricacies of API platform and how all the operations work, but something strange is happening with the routing. This may be linked to #6969. You should be able to call |
My bad on this I'm missing a test, weird that phpstan didn't trigger on this being nullable, my guess is that we ignore the
Yes but it's expected that
Nothing has an impact on routing except the lines you changed at #6969 |
Thanks @jonerickson ! |
Problem
This PR aims to give more granularity when setting middleware for different features/routes this package provides. The most notable is the ability to enable the GraphQL IDE independent of the actual endpoint. Second, a developer can set middleware explicitly for the GraphQL routes.
Story
An application may want to expose the GraphQL IDE for consumer use. This endpoint may want to use the
web
andauth
middleware for session authentication which typically is not wanted/needed for the API endpoints where a dev would probably opt for some kind of JWT/API/OAuth implementation.Or, a dev may want to allow GraphQL requests, but does not want the IDE to be exposed in production.
Adding these settings allows more flexibility on how these features can be used.
Changes
graphhiql
independent of thegraphql
POST endpoint.graphql
endpoint and GraphQL IDEgraphiql
endpoint.Remove unusedapi-platform.defaults.middleware
config setting? I could not find any reference to this config setting and it clashes/confusing with the global middleware set inapi-platform.routes.middleware
.Moved and renamedapi-platform.defaults.route_prefix
setting toapi-platform.routes.prefix
. Backwards compatibility is provided. This aims to move all routes related config under a common config key versus spread out in the config file.