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

Open
wants to merge 1,005 commits into
base: 3.3
from

Conversation

@andris-sevcenko
Copy link
Member

commented Jul 12, 2019

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.

@andris-sevcenko andris-sevcenko requested a review from brandonkelly Jul 12, 2019

@brandonkelly brandonkelly changed the title Add GQL Add GraphQL AP Jul 12, 2019

@brandonkelly brandonkelly changed the title Add GraphQL AP Add GraphQL API Jul 12, 2019

angrybrad and others added some commits Aug 5, 2019

gtettelaar and others added some commits Aug 17, 2019

@andris-sevcenko

This comment has been minimized.

Copy link
Member Author

commented Aug 19, 2019

@monachilada you can accomplish that by (and that is now the recommended way) setting up a route that points to the gql action. For example, if your config/routes.php file looks like

return [
    'api' => 'gql',
    // ...
];

Then curl --header "Authorization: Bearer ABC123" http://domain.local/api?token=XYZ987&query=%7BqueryEntries%7Btitle%7D%7D should work.

andris-sevcenko and others added some commits Aug 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.