Pro Yearly is on sale from $80 to $50! »

OXID Academy - GraphQL within OXID eShop

OXID Academy - GraphQL within OXID eShop

#OXID_eSales
Ever wanted to create a GraphQL API within OXID eShop? The wait is over. We @OXID_eSales released the GraphQL-Base module which allowes you to create GraphQL queries and mutations in OXID.

https://github.com/OXID-eSales/graphql-base-module
https://github.com/OXID-eSales/graphql-catalogue-module
https://github.com/OXID-eSales/graphql-account-module
https://graphqlite.thecodingmachine.io/docs/3.0/features.html

8b8824ec70715f8599896375626c20d9?s=128

Florian Engelhardt

August 06, 2020
Tweet

Transcript

  1. OXID Academy Webinar GraphQL within OXID eShop GraphQL within OXID

    eShop 1
  2. GraphQL 2

  3. GraphQL? GraphQL? 3

  4. GraphQL? GraphQL? a query language for your API 3

  5. GraphQL? GraphQL? a query language for your API ask for

    what you need, get exactly that 3
  6. GraphQL? GraphQL? a query language for your API ask for

    what you need, get exactly that get many resources in a single request 3
  7. GraphQL? GraphQL? a query language for your API ask for

    what you need, get exactly that get many resources in a single request describe what’s possible with a type system 3
  8. Start with a schema definition Start with a schema definition

    type Query { category(id: String!): Category } type Category { id: ID! title: String! active: Bool! articles: [Article] parent: Category siblings: [Category] children: [Category] } type Article { id: ID! title: String! category: Category } 4
  9. How to query that How to query that { query

    { category(id: "943a9ba3050e78b443c16e043ae60ef3") { id title children { id title } } } } 5
  10. What do you get? What do you get? { "data":

    { "category": { "id": "943a9ba3050e78b443c16e043ae60ef3", "title": "Kiteboarding", "children": [ { "id": "0f41a4463b227c437f6e6bf57b1697c4", "title": "Trapeze" }, { "id": "0f4f08358666c54b4fde3d83d2b7ef04", "title": "Kiteboards" } ] } } } 6
  11. 7

  12. GraphQLite GraphQLite Create a complete GraphQL API by simply annotating

    your PHP classes — GraphQLite docs 8
  13. Basic Example - Controller Basic Example - Controller class CategoryController

    { /** * @Query() */ public function category(string $id): Category { // Some code that looks for a category and returns it. } } 9
  14. Basic Example - Type Basic Example - Type /** *

    @Type() */ class Category { /** * @Field() */ public function getTitle(): string { return $this->title; } // ... } 10
  15. Basic Example - The Schema Basic Example - The Schema

    type Query { category(id: String!): Category } type Category { title: String! } 11
  16. Howto get this running in OXID? Howto get this running

    in OXID? 12
  17. oxid-esales/graphql-base oxid-esales/graphql-base bootstrap GraphQLite auth using JWT 13

  18. Howto use this in my module? Howto use this in

    my module? 14
  19. Howto use this in my module? Howto use this in

    my module? create a namespace mapper class 14
  20. Howto use this in my module? Howto use this in

    my module? create a namespace mapper class tag this class graphql_namespace_mapper in services.yaml 14
  21. Howto use this in my module? Howto use this in

    my module? create a namespace mapper class tag this class graphql_namespace_mapper in services.yaml create a permission provider class 14
  22. Howto use this in my module? Howto use this in

    my module? create a namespace mapper class tag this class graphql_namespace_mapper in services.yaml create a permission provider class tag this class graphql_permission_provider in services.yaml 14
  23. Sounds complicated Sounds complicated 15

  24. Sounds complicated Sounds complicated composer create-project oxid-esales/graphql-module-skeleton 15

  25. DEMO TIME! DEMO TIME! 16

  26. Roadmap - Business Roadmap - Business Queries, mutations and types

    for Catalog - 0.1 Account - in progress Checkout 17
  27. Roadmap - Tech Roadmap - Tech GraphQLite v4 Caching (and

    cache invalidation ) 18
  28. 19

  29. Further readings Further readings https://graphql.org https://graphqlite.thecodingmachine.io/ https://github.com/OXID-eSales/graphql-base-module https://github.com/OXID-eSales/graphql-catalogue-module https://github.com/OXID-eSales/graphql-account-module 20