Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Chucker で GraphQL の通信ログを見やすくした / Made GraphQL l...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
140
matching_dev1
bird_tummy
0
280
dxel1
bird_tummy
0
4k
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
A designer walks into a library…
pauljervisheath
211
24k
Odyssey Design
rkendrick25
PRO
2
700
GitHub's CSS Performance
jonrohan
1033
470k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
590
The World Runs on Bad Software
bkeepers
PRO
72
12k
Become a Pro
speakerdeck
PRO
31
6k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
From π to Pie charts
rasagy
0
210
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
240
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Navigating Weather and Climate Data
rabernat
0
220
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
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