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
The Curse of the Amulet
leimatthew05
3
16k
Docker and Python
trallard
47
4.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
450
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
RailsConf 2023
tenderlove
30
1.6k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
ラッコキーワード サービス紹介資料
rakko
5
5.6M
Done Done
chrislema
187
17k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
600
Discover your Explorer Soul
emna__ayadi
2
1.3k
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