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
440
AutoLayout と友達になる方法 / How to be friends with AutoLayout
bird_tummy
1
3.2k
初めて転職して思ったこと / ngineerxiv11
bird_tummy
0
410
"DO NOT translate when you talk or listen" を実現するためにやっていること / clem6
bird_tummy
2
210
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Faster Mobile Websites
deanohume
310
32k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
KATA
mclloyd
PRO
35
15k
How GitHub (no longer) Works
holman
316
150k
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
580
Google's AI Overviews - The New Search
badams
0
1.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Navigating Weather and Climate Data
rabernat
0
530
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
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