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
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
330
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
280
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
260
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
260
C++26 エラー性動作
faithandbrave
2
720
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
2024年にチャレンジしたことを振り返るぞ
mitchan
0
130
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
230
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
Featured
See All Featured
Done Done
chrislema
181
16k
Building Your Own Lightsaber
phodgson
103
6.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
A Philosophy of Restraint
colly
203
16k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
It's Worth the Effort
3n
183
28k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
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 • ΦνͰ͢ • ྑ͍ॴɿࣗ࡞ͳͷͰ৭ʑޠΔ͜ͱ͕͋Δ • ѱ͍ॴɿ͜ͷεϥΠυʹ༰͕ͳ͍
૯ධɿ ΈΜͳͬͯ͘ Εʂʂʂ
͝ਗ਼ௌ ͋Γ͕ͱ͏ ͍͟͝·ͨ͠ʂ