Skip to content
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

Add GraphQL API #4540

Merged
merged 368 commits into from Aug 27, 2019
Merged

Add GraphQL API #4540

merged 368 commits into from Aug 27, 2019

Conversation

andris-sevcenko
Copy link
Contributor

Todo list (also in services/Gql.php)

  1. Obviously, docs for everything and every method (including exceptions thrown)
  • services/gql
  • helpers/gql
  • gql/*
  • Description for every field on GQL types. For hard-coded types this goes in type definition files. For actual Craft fields we can reuse the instructions property.
  1. Event for registering interfaces (because they get eager-loaded if prebuildSchema is set to true when building schema.)
  2. Eager-loading currently ignores the passed arguments. Some tests are borked because of that. This includes the limit argument to relation fields currently.
  3. Maybe move out token permissions to a separate service?
  4. Speaking of, maybe put the token settings somewhere else on the Craft settings page and definitely add an icon
  5. Figure out and add query complexity costs per GQL type.
  6. Configurable limits on both query complexity and nesting level.
  7. Sprinkle some cache on top (see if able to integrate with Craft template caching, as similar principles should apply - element changes invalidate a cached response and structural changes (when project config gets updated) invalidates cached responses. Cached by token by query.
  8. Pretty sure the test coverage went down with the last dev iteration - circle back and check.
  9. Tests for disabled and expired tokens.
  10. Tests for matrix blocks returning correct union types.
  11. Expose site structure over GQL as well
  12. Once (12) is in place, get rid of, say, sectionId and sectionUid fields and replace with a section type that has uid and id fields.
  13. MAYBE change all closures to static method and make schema itself cacheable per token per query.

@brandonkelly
Copy link
Member

brandonkelly commented Aug 26, 2019

For those of you that have been testing against the feature/graphql branch, we pushed a couple breaking changes today to be aware of:

  • The “tokens” concept has been renamed to “schemas”, and they are stored in a different database table now. When you get this change, your old gqltokens table will still be there, but Craft won’t use it anymore. You will need to recreate your schemas, and delete the old gqltokens table when you’re ready.

  • The gql action has been renamed to graphql/api. Update your config/routes.php file accordingly.

  • queryEntries is now entries (et al.).

@brandonkelly brandonkelly merged commit b5c1280 into 3.3 Aug 27, 2019
@brandonkelly brandonkelly deleted the feature/graphql branch August 27, 2019 00:25
brandonkelly added a commit that referenced this pull request Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants