Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GraphQL 💙 Kotlin, 2024 edition

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →
mbonnin
February 16, 2024

GraphQL 💙 Kotlin, 2024 edition

mbonnin

February 16, 2024

Transcript

36 slides
  1. GraphQL describes your product Graph 4 Feed Post Post Ad

    Title Text XL Thumbnail S Thumbnail
  2. Type system 10 type User { login: String bio: String

    isBountyHunter: Boolean status: UserStatus issueComments: List<IssueComment> }
  3. • Objects Type system 11 type User { login: String

    bio: String isBountyHunter: Boolean status: UserStatus issueComments: List<IssueComment> }
  4. • Objects • Scalars ◦ Boolean Type system 12 type

    User { login: String bio: String isBountyHunter: Boolean status: UserStatus issueComments: List<IssueComment> }
  5. • Objects • Scalars ◦ Boolean ◦ Int ◦ Float

    ◦ String Type system 13 type User { login: String bio: String isBountyHunter: Boolean status: UserStatus issueComments: List<IssueComment> }
  6. • Objects • Scalars ◦ Boolean ◦ Int ◦ Float

    ◦ String Type system 14 type User { login: String bio: String isBountyHunter: Boolean status: UserStatus issueComments: List<IssueComment> }
  7. • Objects • Scalars ◦ Boolean ◦ Int ◦ Float

    ◦ String • Lists Type system 15 type User { login: String bio: String isBountyHunter: Boolean status: UserStatus issueComments: List<IssueComment> }
  8. • Interfaces • Unions Polymorphisme 16 interface Node { id:

    String } type User implements Node { id: String login: String bio: String [...] }
  9. Nullability! 17 type User { login: String❗ bio: String isBountyHunter:

    Boolean❗ status: UserStatus issueComments: List<IssueComment>❗ }
  10. ❤

  11. Autres propriétés de GraphQL 19 • No overfetching • Strongly

    typed • Introspection • No versioning • Transport agnostic
  12. Codegen 23 { sessions { nodes { language title startsAt

    speakers { name } } } } class Session(val nodes: List<Node>) class Node( val language: String, val title: String, val startsAt: DateTime, val speakers: List<Speaker> ) class Speaker(val name: String)
  13. Depreciation 24 class Node( @Deprecated("startsAt uses non ISO 8601 format,

    use startDateTime instead") val startsAt: String, ) type Conference { startsAt: String @deprecated(reason: "startsAt uses non ISO 8601 format, use startDateTime instead") startDateTime: DateTime }
  14. ❤

  15. GraphQL vs REST REST GraphQL resources graph multiple routes single

    endpoint swagger/open API builtin tooling versioning continuous evolution static queries dynamic queries
  16. Persisted queries { sessions { nodes { language title startsAt

    speakers { name } } } } 57e2978c855b25cf5de4ba4a0160cf7402b3f393 Enregistrement des queries pendant le build
  17. Persisted queries GET confetti-app.dev/graphql?operationId=57e2978c855b25cf5de4ba4a0160cf7402b3f393 { "data": { "sessions": { "nodes":

    [ { "language": "en-US", "title": "Android Graphics: the Path to [UI] Riches", "startsAt": "2023-04-27T09:15", "speakers": [ { "name": "Chet Haase" }, { "name": "Romain Guy" } ] }
  18. A brief history of 2012 Inception at meta 2015 Open

    source 2018 GraphQL Foundation SDL 2021 Last spec version You are here Nullability 2024 Draft Deprecated input values Full unicode

More Decks by mbonnin

Other Decks in Technology