Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Chucker で GraphQL の通信ログを見やすくした / Made GraphQL l...
Search
Ryo.Nitami
August 27, 2019
1.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Chucker で GraphQL の通信ログを見やすくした / Made GraphQL log easier to read on Chucker
@ potatotips #64
Ryo.Nitami
August 27, 2019
More Decks by Ryo.Nitami
See All by Ryo.Nitami
20220927_mot_kauche_tummy
bird_tummy
0
150
matching_dev1
bird_tummy
0
290
dxel1
bird_tummy
0
4.1k
GraphQL in production
bird_tummy
3
3.6k
livedata-plus-viewmodel
bird_tummy
0
3.7k
何も準備せずにノリで上海に行ったら大変だった話 / shanghai-is-wonderful
bird_tummy
0
450
AutoLayout と友達になる方法 / How to be friends with AutoLayout
bird_tummy
1
3.2k
初めて転職して思ったこと / ngineerxiv11
bird_tummy
0
420
"DO NOT translate when you talk or listen" を実現するためにやっていること / clem6
bird_tummy
2
220
Featured
See All Featured
Are puppies a ranking factor?
jonoalderson
2
4.1k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
780
Game over? The fight for quality and originality in the time of robots
wayneb77
1
320
Tell your own story through comics
letsgokoyo
1
1.1k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
460
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
490
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
290
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.7k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1.1k
Transcript
Chucker Ͱ GraphQL ͷ௨৴ϩάΛݟͨ͘͢͠
͜͏͍͏ऀͰ͢ • Ryo Nitami (a.k.a tummy) • Mobile App Engineer
@ CyberAgent, Inc. • SHISHAMO ͱ͍͏όϯυΛṆѪͯ͠·͢ • ϥΠϒʹΑ͘ߦ͖·͢ɻࠓͷࢀઓ͕ 60 ऑʹ ͳΔ༧ఆɻ
tl;dr • issue: https://github.com/ChuckerTeam/chucker/issues/69 • pull request: https://github.com/ChuckerTeam/chucker/pull/70
Chucker ͱʁ • OkHttp ͷ௨৴ϩάΛऔͬͯҰཡͰදࣔͯ͘͠ΕΔπʔϧ • jgilfelt/chuck ͕͢Ͱʹ͋Δ͕ɺ2 Ҏ্ߋ৽͞Ε͍ͯͳ͍ͷͰ fork
͞ΕɺผϦ ϙδτϦͰߋ৽͞Ε࢝Ίͨ
Chucker ͷ͍͍ͱ͜Ζ • OkHttp 4 ରԠࡁΈ • Ϩεϙϯεͷதʹը૾͕͋Δ߹ɺͪΌΜͱදࣔͯ͘͠ΕΔ ʢόΠφϦܗࣜʹͳ Βͳ͍ʣ
• ςΩεταʔνͨ͠ͱ͖ʹҾ͔͔ͬͬͨจࣈྻ͕ ϋΠϥΠτ͞ΕΔ Α͏ʹͳͬͨ
Chucker ͷ͍·͍ͪͩͬ ͨͱ͜Ζ • GraphQL ͷ௨৴ϩά͕ͯ͢ 200 POST / <endpoint-name>
ʹͳΔ •ͳͥ͜͏ͳΔͷ͔ʁ
GraphQL ୯ҰΤϯυϙΠϯτ͕ਪ ͞Ε͍ͯΔ1 1 https://graphql.org/learn/serving-over-http/#uris-routes
ϓϧϦΫΛ͛Δ͜ͱʹͨ͠
·ͣ issue Ͱ૬ஊ • ࣮ํ๏ͷೝࣝΛ͢Γ߹ΘͤΔͨΊɺissue Ͱ૬ஊ • ݁Ռɺ ΤϯυϙΠϯτͷදهͭͭ͠ɺoperationName ͱ
GraphQL ͷΞΠί ϯΛදࣔ͢Δܗࣜ Ͱܾఆ • operationName : Ϩεϙϯεϔομʔʹ͋ΓɺͦΕΛ͏͜ͱͰͲͷϦιʔε Λࢀর͔ͨ͠அͰ͖Δ2 2 https://graphql.org/learn/queries/#operation-name
࣮ • طଘͷαϯϓϧΞϓϦͰ Retrofit ͕ΘΕ͍ͯͨͷͰ retrofit-graphql Ͱ࣮ • ϨϏϡʔΛ͓ئ͍ͨ͠Β Change
Request ͕ val request = QueryContainerBuilder().putVariable("first", 10) with(SampleApiService.getGraphQLInstance(getClient(this))) { getAllFilms(request.apply { setOperationName("AllFilms") }).enqueue(cb) getAllPeople(request.apply { setOperationName("AllPeople") }).enqueue(cb) getAllPlanets(request.apply { setOperationName("AllPlanets") }).enqueue(cb) getAllSpacies(request.apply { setOperationName("AllSpacies") }).enqueue(cb) getAllStarships(request.apply { setOperationName("AllStarships") }).enqueue(cb) getAllVehicles(request.apply { setOperationName("AllVehicles") }).enqueue(cb) }
࣮Ͱࢦఠ͞Εͨͱ͜Ζ • ͳΔ͘αʔυύʔςΟͷϥΠϒϥϦೖΕͳ͍ • ϥΠϒϥϦ ݴޠ༷ʹґଘ͢Δ͖ • retrofit-graphql আ •
ఆٛͨ͠ .graphql ϑΝΠϧΛͱʹ͏ΫΤϦΛࢦఆ͍͕ͯͨ͠ɺϦΫΤετΛ ૹΔ͚ͩͩͬͨΒඞཁͳ͍ʢϥΠϒϥϦͰ༻͍ͯͨ͠ʣ • json Λ࡞ͬͯ POST ͯ͠ಉ݁͡ՌʹͳΔ • .graphql ϑΝΠϧΛͯ͢আͯ͠ɺPOST ༻ͷ JSON Λผʹఆٛͯ͠༻
͜͏ͳΓ·ͨ͠ ·ͩमਖ਼தͰ͕͢ɺ3.1.0 Ͱ͜͏ͳΔ༧ఆͰ͢ɻ
·ͱΊ • Chucker ʹ GraphQL ͷ௨৴ϩάΛݟ͘͢͢Δ PR Λૹͬͨ3 • ଞݴޠͰศརͦ͏ͳπʔϧ͕͋ΕɺϞόΠϧଆʹͲΜͲΜҠ২͍͖͍ͯͨ͠
• Facebook ͔ͩΒ͔ɺJavaScript ͋ͨΓͷίϛϡχςΟ͕׆ൃ • ྫɿQuipper ͞Μͷσόοάπʔϧ4 4 https://quipper.hatenablog.com/entry/2019/08/13/making-tool-to-debug-graphql-client 3 https://github.com/ChuckerTeam/chucker/pull/70