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
200
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
Alba: Why, How and What's So Interesting
okuramasafumi
0
190
Why did my proposals get rejected?
okuramasafumi
1
510
A suggestion for the future of RDoc
okuramasafumi
1
150
Tech Events, Should We See Them from the Outside or the Inside?
okuramasafumi
1
47
Creating gems 101
okuramasafumi
1
94
How NOT to make your DSL terrible
okuramasafumi
0
390
オブジェクトしこう
okuramasafumi
2
300
Debugging Alba
okuramasafumi
1
210
Learning Ruby
okuramasafumi
5
580
Other Decks in Technology
See All in Technology
深層学習と3Dキャプチャ・3Dモデル生成(土木学会応用力学委員会 応用数理・AIセミナー)
pfn
PRO
0
450
デジタルアイデンティティ技術 認可・ID連携・認証 応用 / 20250114-OIDF-J-EduWG-TechSWG
oidfj
2
520
AWSマルチアカウント統制環境のすゝめ / 20250115 Mitsutoshi Matsuo
shift_evolve
0
100
SpiderPlus & Co. エンジニア向け会社紹介資料
spiderplus_cb
0
780
OPENLOGI Company Profile for engineer
hr01
1
18k
新しいスケーリング則と学習理論
taiji_suzuki
10
3.8k
Azureの開発で辛いところ
re3turn
0
240
シフトライトなテスト活動を適切に行うことで、無理な開発をせず、過剰にテストせず、顧客をビックリさせないプロダクトを作り上げているお話 #RSGT2025 / Shift Right
nihonbuson
3
2k
WantedlyでのKotlin Multiplatformの導入と課題 / Kotlin Multiplatform Implementation and Challenges at Wantedly
kubode
0
240
Cloudflareで実現する AIエージェント ワークフロー基盤
kmd09
0
270
EMConf JP の楽しみ方 / How to enjoy EMConf JP
pauli
2
140
Godot Engineについて調べてみた
unsoluble_sugar
0
340
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1366
200k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
350
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
192
16k
The Pragmatic Product Professional
lauravandoore
32
6.4k
The Invisible Side of Design
smashingmag
299
50k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.6k
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 • ΦνͰ͢ • ྑ͍ॴɿࣗ࡞ͳͷͰ৭ʑޠΔ͜ͱ͕͋Δ • ѱ͍ॴɿ͜ͷεϥΠυʹ༰͕ͳ͍
૯ධɿ ΈΜͳͬͯ͘ Εʂʂʂ
͝ਗ਼ௌ ͋Γ͕ͱ͏ ͍͟͝·ͨ͠ʂ