タグ

JSONに関するYassLabのブックマーク (9)

  • 翻訳: WebAPI 設計のベストプラクティス - Qiita

    Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? これは Enchant の開発者である Vinay Sahni さんが書いた記事「Best Practices for Designing a Pragmatic RESTful API」1を、ご人の許可を得て翻訳したものです。 RESTful な WebAPI を設計しようとすると、細かなところで長考したり議論したりすると思います。また、他の API に倣ってやってはみたものの、当にそれでいいのか、どうしてそうしているのか分からない、何てことも少なくはないと思います。 この記事では、そのようなハマリどころについて Vinay さん

    翻訳: WebAPI 設計のベストプラクティス - Qiita
    YassLab
    YassLab 2026/03/01
    “私が思う API の勘所をお伝えします / できる限り Web の標準に従うこと / 開発者に親切な作りにすること。また、ブラウザのアドレスバーから叩けるようにすること / シンプルで一貫性を持たせ、直感的かつ心地よく”
  • フロントエンドに汎用APIを使わせてはいけない(4年後の続編記事)(翻訳)|TechRacho by BPS株式会社

    概要 元サイトの許諾を得て翻訳・公開いたします。 英語記事: Don’t Build a General Purpose API (4 Years Later) - Max Chernyak 原文公開日: 2025年12月11日 原著者: Max Chernyak 日語タイトルは内容に即したものにしました。 私は2021年に、フロントエンド向けにわざわざ汎用のAPIを構築して苦労を増やしてはいけないと呼びかける記事を書きました↓(よろしければ記事を読む前に目を通しておいてください)。 参考: Don’t Build A General Purpose API To Power Your Own Front End - Max Chernyak この記事はHacker Newsに2度取り上げられましたが、2度目は評判がよろしくありませんでした(その分議論は白熱しましたが)。推測ですが、2

    フロントエンドに汎用APIを使わせてはいけない(4年後の続編記事)(翻訳)|TechRacho by BPS株式会社
    YassLab
    YassLab 2026/02/20
    "汎用APIをこしらえたせいで問題が発生したら、その問題を解決せずに隠蔽するために、また別のレイヤをこしらえる / バックエンドのコード量は倍増し、複雑さは2倍にも3倍にもなり、そこに注がれる時間と労力も増える"
  • モダンフロントエンドはJSON APIが鬱陶しいので、無くしていきたい

    はじめに Kaigi on Rails 2025で発表し、何人かの人といろいろ話しているうちに、モダンフロントエンドが面倒臭いのはJSON APIのせいではないかと考えるようになりました。そしてJSON APIそのものが悪いというよりは、JSON APIを必要以上に使う原因となっているSPAが問題ではないかと思っています。まだ考えは固まっていないのですが、まずは部分的に紹介したいと思います。 モダンフロントエンドはJSON基礎工事が大変 SPAのReactフロントエンドを作る場合、Hotwireなら不要だった多大な工数が新しく発生します。 APIエンドポイントのルータおよびコントローラから、JSON APIシリアライザ、クライアントサイドのルータ、JSON APIをfetchしてフォーマット変換する作業、さらにAPIの契約を文書化したOpen APIを作成します。ここには記載していませんが

    モダンフロントエンドはJSON APIが鬱陶しいので、無くしていきたい
    YassLab
    YassLab 2025/10/16
    “実現する方法は(流行りの言葉では)island化と呼ばれるものです。インタラクティブ性が要求されるところだけをReactなどで書き、それ以外はサーバでレンダリングする方法です。”
  • Optimizing Ruby’s JSON, Part 4

    In the previous post, we established that as long as ruby/json wasn’t competitive on micro-benchmarks, public perception wouldn’t change. Since what made ruby/json appear so bad on micro-benchmarks was its setup cost, we had to find ways to reduce it further. Spot the Seven Differences So I decided to file this performance discrepancy as a bug, and investigate it as such and started profiling Step

    YassLab
    YassLab 2025/01/01
    "with all the above optimizations, we were now faster than Oj when reusing the JSON::State object, but still quite a bit slower when allocating it on every call ... So there was no way around it, I had to find how to automatically re-use that JSON::State object. Or how to not allocate it at all?"
  • Optimizing Ruby’s JSON, Part 3

    In the previous post, I covered how I reimplemented JSON::Generator::State#configure in Ruby and some other changes. Unfortunately, it didn’t go as well as I initially thought. Mistakes Were Made The default gems that ship with Ruby are automatically copied inside ruby/ruby’s repo. In short, there’s a bot aptly named matzbot, that replicates all the commits from the various ruby/* gems, inside rub

    YassLab
    YassLab 2025/01/01
    “In the next post, we’ll dive into how the setup cost was optimized further, and then at some point, we’ll have to start talking about optimizing the parser.”
  • Optimizing Ruby’s JSON, Part 2

    In the previous post, I covered my motivations for improving ruby/json’s performance, and detailed the first 4 notable optimizations applied to speed up JSON generation. If I was to cover every single optimization applied, at this rate I’d end up with a dozen parts, so I’ll try to only focus on the one that made a significant difference or used an interesting pattern. Reducing Setup Cost - Argumen

    YassLab
    YassLab 2025/01/01
    “At this rate, and based only on the number of commits I haven’t yet covered, I may need 5 or 6 more parts, but I hope I won’t have to disgress as much as the series progress, and not all commits may be worth talking about. Edit: Part three is here.”
  • Optimizing Ruby’s JSON, Part 1

    I was recently made maintainer of the json gem, and aside from fixing some old bugs, I focused quite a bit on its performance, so that it is now the fastest JSON parser and generator for Ruby on most benchmarks. Contrary to what one might think, there wasn’t any black magic or deep knowledge involved. Most of the performance patches I applied were fairly simple optimizations driven by profiling. A

    YassLab
    YassLab 2025/01/01
    “I have way more optimizations than these ones to talk about, but I feel like it’s already a pretty packed blog post. So I’ll stop here and work on some followup soon, hopefully I won’t lose my motivation to write :). / Edit: Looks like I didn’t, part two is here.”
  • 動画コンテンツ(Video)の構造化データをマークアップする方法

    動画コンテンツ(Video)の構造化データをマークアップする方法を紹介します。 動画コンテンツの構造化データをマークアップすると、Googleはその動画に関する情報をより正確に理解できるようになります。 Googleのマット・カッツは、YouTubeなどの動画配信サービスにアップロードした動画であっても、自分のサイトに埋め込む際には動画の構造化データをマークアップすることを推奨しています。構造化データをマークアップすることで、Googleがその動画コンテンツをより正確に理解することにつながるためです。 JSON-LDでマークアップする 動画コンテンツ(Video)をJSON-LDでマークアップする方法です。JSON-LDはページのどこに記述しても問題ありませんが、通常は<head>タグ内に記述します。 <script type="application/ld+json"> { "@cont

    動画コンテンツ(Video)の構造化データをマークアップする方法
    YassLab
    YassLab 2023/02/21
    “サイトに埋め込む際には動画の構造化データをマークアップすることを推奨しています。構造化データをマークアップすることで、Googleがその動画コンテンツをより正確に理解することにつながるためです。”
  • curl-to-ruby: Convert curl commands to ruby's net/http

    Instantly convert curl commands to Ruby's net/http Ruby's net/http is notorious for not having the friendliest API, but it isn't all that bad. Ruby has great gems like faraday, but in libraries and small utilities it's better to kill your dependencies and use what the stdlib provides. This tool turns a curl command into ruby (2.0+) code using net/http. Currently, it knows the following options: -d

    YassLab
    YassLab 2022/12/01
    "Ruby's net/http is notorious for not having the friendliest API, but it isn't all that bad. Ruby has great gems like faraday, but in libraries and small utilities it's better to kill your dependencies and use what the stdlib provides. This tool turns a curl command into Ruby code using net/http."
  • 1