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
210
Featured
See All Featured
Done Done
chrislema
187
17k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
530
Game over? The fight for quality and originality in the time of robots
wayneb77
1
310
A better future with KSS
kneath
240
18k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
New Earth Scene 8
popppiees
4
2.7k
The browser strikes back
jonoalderson
0
1.8k
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.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