Lecturer (PJATK), Java Trainer (infoShare Academy) ‣7+ years of experience in Java Development ‣using GraphQL for over a year now ‣E-mail: [email protected] ‣Twitter: krzychpawlowski
String name String email String bio List<BlogEntry> blogEntries <<class>> BlogEntry Long id String title List<Comment> comments <<class>> Comment Long id String author String comment
Long id String name String email String bio List<BlogEntry> blogEntries <<class>> BlogEntry Long id String title List<Comment> comments <<class>> Comment Long id String author String comment
<<class>> Author Long id String name String email String bio List<BlogEntry> blogEntries <<class>> BlogEntry Long id String title List<Comment> comments <<class>> Comment Long id String author String comment
name blogEntry { title comment { comment } } } <<class>> Author Long id String name String email String bio List<BlogEntry> blogEntries <<class>> BlogEntry Long id String title List<Comment> comments <<class>> Comment Long id String author String comment
released in 2015 as open source project ‣Major clients: Apollo, Relay ‣GraphQL servers available in multiple languages: ‣Java ‣JavaScript ‣Python ‣Ruby ‣C# ‣Scala ‣Go ‣…
and a runtime for fulfilling those queries with your existing data.” — http://graphql.org Declarative Ask for what you need, get exactly that Compositional Get many resources in a single request
and a runtime for fulfilling those queries with your existing data.” — http://graphql.org Declarative Ask for what you need, get exactly that Compositional Get many resources in a single request Strongly Typed Describe what’s possible with a type system
Java 8 ‣allows to implement GraphQL schema ‣contains executor for GraphQL queries and mutations ‣BUT a lot of boiler-plate code to configure GraphQL and no support for Spring Framework
controller under /v1/graphql <dependency> <groupId>com.merapar</groupId> <artifactId>graphql-spring-boot-starter</artifactId> <version>1.0.2</version> </dependency> ‣adding new queries and mutation is a matter of implementing GraphQlFields interface ‣very useful with micro-services
items TTL) ‣Invalidating key ‣when mutation executed (data changed only via GraphQL API) ‣when notification from service received (via RabbitMQ, Kafka, other messaging system)
repositories, many services called at once) ‣End-user doesn’t know the internal implementation ‣Solution: ‣No cycles in schema ‣If cycles —> max level of nesting in response json must be set type Person { id: ID! name: String! friends: [Person] }
authentication and authorisation in GraphQL ‣JWT token (eg. Auth0 or Cognito) ‣GraphQL end-point secured like REST endpoint in Spring Boot ‣Roles must be handled in Data Fetchers