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

Developer Experience in GraphQL Schema-first Development

Developer Experience in GraphQL Schema-first Development

This slides shows how GraphQL schema-first development worked on my team.

Talked at GraphQL について語る会
https://m3-engineer.connpass.com/event/145259/

Takayuki Matsubara

October 09, 2019
Tweet

More Decks by Takayuki Matsubara

Other Decks in Programming

Transcript

  1. Developer Experience in GraphQL
    Schema-first
    Development
    2019/10/09 @ma2ge

    View Slide

  2. self-introduction
    • Takayuki Matsubara
    [email protected]
    [email protected]
    • Ruby, Elixir, OSS, Keyboards and
    • PowerAssertEx
    ⭐#
    • github.com/ma2gedev/power_assert_ex

    View Slide

  3. self-introduction
    • GraphQL
    • ΤϜεϦʔςοΫϒοΫ#1 @ ٕज़ॻ
    య6(2019/04)

    View Slide

  4. Developer Experience in GraphQL
    Schema-first
    Development

    View Slide

  5. Schema-first
    development

    View Slide

  6. in GraphQL
    • Define schema first, next implement
    based on schema
    # Book
    type Book {
    # what is book
    ...
    }
    type Query {
    # returns book list
    books: [Book]!
    }

    View Slide

  7. Pros
    • Develop Client/Server concurrently
    • Documentation

    View Slide

  8. View Slide

  9. In the real world

    View Slide

  10. Our team
    • iOS 2
    • Android 2
    • Server 2(almost 1.5)

    View Slide

  11. Until then
    • Gateway provides REST API - built in
    2010 before Swagger1
    • API documentation outside of code
    • Develop with mocking REST API or
    implement server first
    1 https://github.com/swagger-api/swagger-core

    View Slide

  12. Carrying GraphQL to the team

    View Slide

  13. Develop Client/Server
    concurrently

    View Slide

  14. Struggled at the beginning
    • Schema was defined but...
    • Client made client-specific mock(not
    apollo) because of server's mock
    returned less patterns of data
    • Insufficient disucussion about
    schema

    View Slide

  15. Improved for each Scrum's
    iteration
    • Schema and mock was defined
    before each development
    • Defined schema first helped to our
    team's resource balance(I think it
    leads more flexibility about team
    members role)

    View Slide

  16. Documentation

    View Slide

  17. Before GraphQL
    • Sometimes forgot to update

    View Slide

  18. Update documentation with code after GraphQL
    • Ensure schema and code are same
    • Cons: comments are not required
    type Query {
    # returns book list
    books: [Book]!
    }

    View Slide

  19. and more...

    View Slide

  20. Easy to disucuss about schema and query
    • from client and server perspectives
    • at review time on GitLab
    • chatting based on query
    • SDL(Schema Definition Language) formatted
    documentation

    View Slide

  21. Summary
    • Schema-first development worked our team

    View Slide

  22. END
    2019/10/09 @ma2ge

    View Slide

  23. Resources
    • 1. Build a schema - Apollo Basics - Apollo GraphQL Docs
    • https://www.apollographql.com/docs/tutorial/schema/
    • GraphQL APIΛεΩʔϚϑΝʔετ։ൃ͢ΔͨΊͷϞοΫ
    αʔόΛRailsͱApolloͰ࡞Δ
    • https://blog.kymmt.com/entry/mocking-graphql-server-
    with-rails-and-apollo

    View Slide

  24. Resources
    • ϑϩϯτΤϯυ޲͚ͷ API αʔόϦχϡʔΞϧʹ GraphQL
    Λݕ౼͍ͯ͠Δ࿩ - ΤϜεϦʔςοΫϒϩά
    • https://www.m3tech.blog/entry/graphql-on-spring-boot-
    with-kotlin

    View Slide