[3.1] Opt into GraphQL resources/queries#3289
Merged
jasonvarga merged 8 commits intomasterfrom Mar 5, 2021
Merged
Conversation
i misread the changelog. reduceWithKeys only appeared in 8.x i could use reduce, but it doesn't accept the keys before 8.x
…e tests, and test for disabled ones.
# Conflicts: # CHANGELOG.md
jasonvarga
added a commit
to statamic/docs
that referenced
this pull request
Mar 5, 2021
eg. "collections => true" will enable collection/collections/entry/entries queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rather than exposing all data by default this PR forces developers to opt into queries by specifying which resources they want to allow.
Previously we went with the "if you enable it, you're aware you get it all" approach. It felt too easy to enable too much. This feels like a safer default.
This also allows us to add more queries later without them becoming automatically enabled without the developer realizing.
The exception is the
pingquery, which is always enabled.You will need to add the following to your
config/statamic/graphql.phpfile. (Either the whole array or just the ones you want to enable, and set them totrue:There's a corresponding PR for the REST API #3318 to become opt-in per endpoint for 3.1.
Note that this PR only enables/disables entire queries. ie. you can query entries from zero collections or any collection. Unlike the REST API PR that lets you enable certain collections. We can add the finer control here later.