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
15 JSON serializers for Ruby
Search
Masafumi Okura
September 29, 2024
Technology
2
120
15 JSON serializers for Ruby
https://tokyurubykaigi.github.io/tokyu15/
での発表資料です。
Masafumi Okura
September 29, 2024
Tweet
Share
More Decks by Masafumi Okura
See All by Masafumi Okura
Why did my proposals get rejected?
okuramasafumi
1
470
A suggestion for the future of RDoc
okuramasafumi
1
69
Tech Events, Should We See Them from the Outside or the Inside?
okuramasafumi
1
44
Creating gems 101
okuramasafumi
1
84
How NOT to make your DSL terrible
okuramasafumi
0
310
オブジェクトしこう
okuramasafumi
2
220
Debugging Alba
okuramasafumi
1
200
Learning Ruby
okuramasafumi
5
570
How to build a conference for both newbies and seasoned devs
okuramasafumi
1
1.9k
Other Decks in Technology
See All in Technology
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
830
UI State設計とテスト方針
rmakiyama
2
260
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
23
11k
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
500
5分でわかるDuckDB
chanyou0311
10
3.2k
非機能品質を作り込むための実践アーキテクチャ
knih
2
610
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
20241220_S3 tablesの使い方を検証してみた
handy
3
170
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
250
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
The Language of Interfaces
destraynor
154
24k
Making the Leap to Tech Lead
cromwellryan
133
9k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
How STYLIGHT went responsive
nonsquared
95
5.2k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Music & Morning Musume
bryan
46
6.2k
Facilitating Awesome Meetings
lara
50
6.1k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Transcript
TokyuRubyձٞ15ه೦ɺ RubyͷJSONγϦΞϥΠβ 15ݸղઆ TokyuRubyձٞ15 2024-09-29 OKURA Masafumi
15ճ։࠵ɺ ͓ΊͰͱ͏ ͍͟͝·͢ʂʂʂ
15
15ʹؔ͢Δ ༗ӹͳΛ͠·͢
15
RubyͷJSON γϦΞϥΠβ * 15
self.pp • ໊લɿ͓͓͘Β·͞;Έ • ॴଐɿϑϦʔϥϯε • ՝֎׆ಈɿKaigi on RailsνʔϑΦʔΨφΠβʔɺOH! MY
RUBYISTS ϙουΩϟετओ࠻ͳͲ • ͦͯ͠ɿTokyuRubyձٞ14 LTԦ
None
1. ActiveModelSeri alizers https://github.com/rails-api/active_model_serializers
ActiveModelSerializers • ੲ͔Β͋ΔγϦΞϥΠβ • ྑ͍ॴɿΠϯλʔωοτ্ʹͨ͘͞Μใ͕͋Δ • ྑ͍ॴɿDSL͕͍͍͢ • ѱ͍ॴɿͱͯͭͳ͍͘ •
ѱ͍ॴɿΓ͍
૯ධɿ ࠓ࠾༻͍͔ͨ͠ͳ ͋ʁ
2. Blueprinter https://github.com/procore-oss/blueprinter
Blueprinter • ൺֱత৽͘͠ɺൺֱత༗໊ʢελʔ1000ʣ • ྑ͍ॴɿൺֱత͍ • ྑ͍ॴɿREADME͕ॆ࣮͍ͯ͠Δ • ѱ͍ॴɿಠಛͳΠϯλʔϑΣʔεʢviewͱ͍͏Έʣ •
ѱ͍ॴɿϝϯςφϯε͕ඍົ
૯ධɿ ͜ΕΛ͓͏͔ͳͱ ࢥ͍ͬͯͨ࣌ظ͕ࢲ ʹ͋Γ·ͨ͠
3. jbuilder https://github.com/rails/jbuilder
jbuilder • RailsͷϏϡʔʹಛԽͨ͠DSL • ྑ͍ॴɿ࠷ॳ͔Βೖ͍ͬͯΔ • ྑ͍ॴɿͬ͘͞ͱJSONΛฦ͢͜ͱ͕Ͱ͖Δ • ѱ͍ॴɿύʔγϟϧ͕͍ •
ѱ͍ॴɿͦͦDSL͕֮͑ΒΕͳ͍ʢ͘͠ͳ͍ʁʣ
૯ධɿ ͦͷDSLɺࢲ ͪΐͬͱ…
4. jb https://github.com/amatsuda/jb
jb • amatsuda wareɺRailsͷϏϡʔͰී௨ͷRuby͕ॻ͚Δ • ྑ͍ॴɿΦʔόʔϔου͕খ͍͞ • ྑ͍ॴɿRubyͦͷ··ͳͷͰֶशίετ͕খ͍͞ • ѱ͍ॴɿRubyͦͷ··ͳͷͰந͕͍
૯ධɿ ࣮݁ߏΘΕͯ ͍ΔͬΆ͍
5. jsonapi- serializer https://github.com/jsonapi-serializer/jsonapi- serializer
jsonapi-serializer • Net fl ix/fast_jsonapiͷϑΥʔΫ • ྑ͍ॴɿJSON:API༷ʹै͏ͳΒ͘ΘΕ͍ͯΔ • ѱ͍ॴɿJSON:API༷ʹै͍ͨ͘ͳ͍
૯ධɿ JSON:APIɺօ͞ ΜͲ͏Ͱ͔͢
6. panko_serializer https://github.com/yosiat/panko_serializer
panko_serializer • OjΛϕʔεʹC֦ுϝΠϯͰॻ͔ΕͨγϦΞϥΠβ • ྑ͍ॴɿ͢͞·͍͘͡ʢ࣍ͷ2ഒҎ্ߴʣ • ѱ͍ॴɿOj͕ඞਢ • ѱ͍ॴɿػೳ͋·Γଟ͘ͳ͍
૯ධɿ C֦ுͣΔ͍ ʢϕϯνϚʔΫతʹʣ
7. representable https://github.com/trailblazer/representable
representable • Trailblazerͱ͍͏Rails֦ுϑϨʔϜϫʔΫͷҰ෦ • ྑ͍ॴɿXMLYAMLग़ྗͰ͖Δ • ѱ͍ॴɿൺֱత • ѱ͍ॴɿJSONग़ྗʹmulti_json͕ඞཁ
૯ධɿ Trailblazer͖ʹ ͍͍ͷ͔ʁ
8. primalize https://github.com/jgaskins/primalize
primalize • ΦϒδΣΫτΛϓϦϛςΟϒܕʹม͢Δͱ͍͏Ξϓϩʔν • ྑ͍ॴɿܕνΣοΫ͕Ͱ͖Δ • ѱ͍ॴɿه๏͕ • ѱ͍ॴɿ͋·Γ͘ͳ͍
૯ධɿ ܕνΣοΫͰ͖Δ ͷྑ͍Ͱ͢Ͷ
9. SimpleAMS https://github.com/vasilakis fi l/SimpleAMS
SimpleAMS • ActiveModelSerializersͷγϯϓϧ൛…ͳͷ͔ʁ • ྑ͍ॴɿAMSΑΓߴ • ѱ͍ॴɿAMSΑΓϝϞϦফඅྔ͕ଟ͍
૯ධɿ γϯϓϧͱ
10. Rails https://github.com/rails/rails
Rails • ࣮Railsʹඪ४ͰγϦΞϥΠβػೳ͕ೖ͍ͬͯΔ • ྑ͍ॴɿRailsΞϓϦͳΒԿΠϯετʔϧ͠ͳͯ͘Α͍ • ྑ͍ॴɿOj.optimize_rails͢ΔͱΊͪΌ͘ͳΔ • ѱ͍ॴɿonly, except,
methodsΛͬͯγϦΞϥΠζ࣌Ͱमਖ਼Ͱ͖ ͯ͠·͏ʢγϦΞϥΠβ͚ͩΛݟͯ࠷ऴग़ྗ͕Θ͔Βͳ͍ʣ
૯ධɿ ͍ͭ͜ɺಈͧ͘ʂ
11. Alba https://github.com/okuramasafumi/alba
Alba • ࡞ • ྑ͍ॴɿPure Rubyʹͯ͠ͱ͍ͯ • ྑ͍ॴɿײతͳDSLʹՃ͑χονͳػೳଟࡌ • ѱ͍ॴɿಛʹͳ͠
૯ධɿ جຊతʹ͜ΕΛ ͓͚͍͍ͬͯ
12. Alba ʢclasslessʣ https://github.com/okuramasafumi/alba/blob/main/ README.md#inline-de fi nition-with-albaserialize
Albaʢclasslessʣ • AlbaΫϥεఆ͕ٛෆཁ • ྑ͍ॴɿίϯτϩʔϥʔͷதʹγϦΞϥΠβΛॻ͖Ͱ͖Δ • ྑ͍ॴɿϒϩοΫΛ͏ͷͰɺparamsͱ͔Λ͑Δ • ѱ͍ॴɿΘͳ͍΄͏͕͍͍
૯ධɿ ࣮ݸਓͰϝϯς͠ ͯΔΞϓϦͰ͜Ε Λ͍ͬͯΔ
13. Alba ʢܕఆ͖ٛͭʣ https://github.com/okuramasafumi/alba/blob/main/ README.md#types
Albaʢܕఆ͖ٛͭʣ • AlbaͰܕఆ͕ٛͰ͖Δ • ྑ͍ॴɿܕఆ͕ٛͰ͖ΔʢͰ͖Δʣ • ѱ͍ॴɿ͔ͤͬ͘ܕఆٛΛͯ͠ɺTypeScriptͷܕʹӨڹ͕ͳ͍
૯ධɿ TypeScriptͷܕ͕ ΄͍͠ΜͰ͢ΑͶ͑
14. Alba ʢw/ typelizerʣ https://github.com/skryukov/typelizer
Alba (w/ typelizer) • AlbaͷܕఆٛγϦΞϥΠβͷఆ͔ٛΒTypeScriptͷܕ͕ಘΒΕΔ • ྑ͍ॴɿސ٬͕ຊʹཉ͔ͬͨ͠ͷ • ྑ͍ॴɿݫີͳఆٛΛॻ͔ͳͯ͋͘ΔఔܕΛ࡞ͬͯ͘ΕΔ •
ѱ͍ॴɿunknown͕ଟ͘ͳΓ͕ͪ
૯ධɿ ଞͷਓ͕ࣗ࡞ϥΠϒ ϥϦΛ֦ுͯ͘͠Ε Δͷͱ͍͍ͯ
15. Alba https://github.com/okuramasafumi/alba
Alba • ΦνͰ͢ • ྑ͍ॴɿࣗ࡞ͳͷͰ৭ʑޠΔ͜ͱ͕͋Δ • ѱ͍ॴɿ͜ͷεϥΠυʹ༰͕ͳ͍
૯ධɿ ΈΜͳͬͯ͘ Εʂʂʂ
͝ਗ਼ௌ ͋Γ͕ͱ͏ ͍͟͝·ͨ͠ʂ