{
    "componentChunkName": "component---src-templates-blog-post-jsx",
    "path": "/post/how-to-test-api-server-with-api-spec/",
    "result": {"data":{"site":{"siteMetadata":{"title":"WEB EGG","author":"Leko - CTO at Yuimedi"}},"markdownRemark":{"id":"93734a4e-c2ac-55ed-a018-ea13665f9e94","excerpt":"この記事はWeb API Advent calendarとHamee Advent Calendar 2015の6日目です。 SPAやハイブリットアプリを仕事でも趣味で作っているので、API…","html":"<p>この記事は<a href=\"http://qiita.com/advent-calendar/2015/web_api\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Web API Advent calendar</a>と<a href=\"http://qiita.com/advent-calendar/2015/hamee\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Hamee Advent Calendar 2015</a>の6日目です。</p>\n<p>SPAやハイブリットアプリを仕事でも趣味で作っているので、APIサーバを実装する機会が増えています。<br>\n手軽にしっかりしたドキュメントを書けて、かつ実装とドキュメントの整合性を保つのってコスト高いな…。と悩んでいます。</p>\n<p>Web APIのドキュメントといえば、<a href=\"http://swagger.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Swagger</a>や<a href=\"http://json-schema.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">JSON-Schema</a>あたりが有名かと思います。<br>\n例えば<a href=\"https://qiita.com/api/v2/docs\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">QiitaのAPIv2</a>はJSON-Schemaを使用して書かれています。</p>\n<p>今回はそれらとは違う<a href=\"https://apiblueprint.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">API Blueprint</a>というツールを使用してAPIドキュメントを作成し、そのAPIドキュメントを自動テストとして実行できる<a href=\"https://github.com/apiaryio/dredd\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Dredd</a>というツールを使用し、<br>\n<strong>APIドキュメントを書いたら、APIサーバのテストもできる</strong> 方法を残します。</p>\n<p>ついでにAPI Blueprint形式のドキュメントをホスティングしてくれる<a href=\"https://apiary.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Apiary</a>とGithubを連携し、masterにマージされたら公開されているAPIドキュメントも最新になるというのもやってみます。</p>\n<!--more-->\n<h2 id=\"まえおき\" style=\"position:relative;\"><a href=\"#%E3%81%BE%E3%81%88%E3%81%8A%E3%81%8D\" aria-label=\"まえおき permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>まえおき</h2>\n<p>今回作成したデモは <a href=\"https://github.com/Leko/godemo\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Leko/godemo</a> にて公開しています。<br>\n今回作成したAPIドキュメントは <a href=\"http://docs.godemo.apiary.io/#\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">こちら</a>にて公開してます。</p>\n<h2 id=\"api-blueprintでapiドキュメントを書く\" style=\"position:relative;\"><a href=\"#api-blueprint%E3%81%A7api%E3%83%89%E3%82%AD%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88%E3%82%92%E6%9B%B8%E3%81%8F\" aria-label=\"api blueprintでapiドキュメントを書く permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>API BlueprintでAPIドキュメントを書く</h2>\n<p>今回はデモとしてTODOアプリ用のAPIを作ってみます。</p>\n<ul>\n<li>GET /api/todos\n<ul>\n<li>自分のTODO一覧を取得する</li>\n<li>completedパラメータを与えるとその状態のTODOのみ取得する。指定がなければどちらも取得する</li>\n</ul>\n</li>\n<li>POST /api/todos\n<ul>\n<li>TODOを作成する</li>\n</ul>\n</li>\n</ul>\n<p>という2つの機能を持つAPIサーバのドキュメントを書きます。</p>\n<p>詳しい記述方法については<a href=\"https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">API Blueprintの仕様</a>を御覧ください。<br>\nだいたい<a href=\"https://github.com/Leko/godemo/blob/master/apiary.apib\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">こんな感じ</a>になるかと思います</p>\n<p>書いたら、プロジェクト直下に<code>apiary.apib</code>というファイル名で保存しておきます。<br>\nファイルの内容はMarkdownですが、API Blueprintというフォーマットで記述しているため拡張子は<code>apib</code>です。</p>\n<h2 id=\"apiサーバを実装する\" style=\"position:relative;\"><a href=\"#api%E3%82%B5%E3%83%BC%E3%83%90%E3%82%92%E5%AE%9F%E8%A3%85%E3%81%99%E3%82%8B\" aria-label=\"apiサーバを実装する permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>APIサーバを実装する</h2>\n<p><a href=\"/post/introduction-of-golang/\">Goに入門してRedis+PostgresなアプリをHerokuにデプロイするまで</a> で作成した<a href=\"https://github.com/Leko/godemo\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Leko/godemo</a>リポジトリに書き足します</p>\n<p>今回はGoの話ではないですし、先ほどの仕様の通りに作っただけなのでさっくり済ませます。</p>\n<h2 id=\"apiaryに公開する\" style=\"position:relative;\"><a href=\"#apiary%E3%81%AB%E5%85%AC%E9%96%8B%E3%81%99%E3%82%8B\" aria-label=\"apiaryに公開する permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Apiaryに公開する</h2>\n<p><a href=\"https://apiary.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Apiary</a>は、API Blueprintで書かれたAPIドキュメントをもとに</p>\n<ul>\n<li>ドキュメントページ(HTML)</li>\n<li>↑のホスティング</li>\n<li>各APIを試せるplayground</li>\n<li>各APIを試せるサンプルソース</li>\n<li>実装がなくても仕様があれば動くモックサーバ</li>\n</ul>\n<p>などなどをまるっと生成してくれるサービスです。</p>\n<p>オレオレドキュメントで作成・管理はかなり手間が大きいと思います。<br>\nplaygroundをいちいち作ったり、サンプルコードで複数言語に対応したり、見やすいドキュメントにしたり、書き手として一貫したドキュメントにすること、など実装のコストもメンテナンスのコストも高くつきます。</p>\n<p>そんなつらみをApiaryが助けてくれます。<br>\n保守コストを抑えつつ、見る人にとってより使いやすい、読みやすいドキュメントを作るための手段の一つだと思います。</p>\n<h2 id=\"apiドキュメントでapiサーバをテストする\" style=\"position:relative;\"><a href=\"#api%E3%83%89%E3%82%AD%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88%E3%81%A7api%E3%82%B5%E3%83%BC%E3%83%90%E3%82%92%E3%83%86%E3%82%B9%E3%83%88%E3%81%99%E3%82%8B\" aria-label=\"apiドキュメントでapiサーバをテストする permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>APIドキュメントでAPIサーバをテストする</h2>\n<p>早速テストしてみます。テストにはApiaryが提供するdreddというツールを使用します。<br>\n導入の注意点として、<strong>Dredd周りのツールがNode4や5に対応しておらず、dreddを入れるためにはnode0.10系が必要になります。</strong> 古い…。</p>\n<blockquote>\n<p><a href=\"https://github.com/apiaryio/dredd/issues/287\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Error compiling on Mac OS X 10.10.5 #287</a><br>\n<a href=\"https://github.com/apiaryio/dredd/issues/292\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Support for node v4.X #292</a></p>\n</blockquote>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre class=\"language-shell\"><code class=\"language-shell\"><span class=\"token function\">npm</span> i -g dredd</code></pre></div>\n<p>テストの環境のセットアップは、ApiaryのTestsタブに記述されています。</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 668px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/51800/Screen-Shot-2015-12-06-at-12.03.57-AM.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 48.50299401197605%; position: relative; bottom: 0; left: 0; background-image: url('data:image/svg+xml,%3csvg%20xmlns=\\'http://www.w3.org/2000/svg\\'%20width=\\'400\\'%20height=\\'194\\'%20viewBox=\\'0%200%20400%20194\\'%20preserveAspectRatio=\\'none\\'%3e%3cpath%20d=\\'M0%2013v12h401V0H0v13\\'%20fill=\\'%23d3d3d3\\'%20fill-rule=\\'evenodd\\'/%3e%3c/svg%3e'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/5251b/Screen-Shot-2015-12-06-at-12.03.57-AM.webp 167w,\n/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/7390e/Screen-Shot-2015-12-06-at-12.03.57-AM.webp 334w,\n/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/7c056/Screen-Shot-2015-12-06-at-12.03.57-AM.webp 668w,\n/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/0a92e/Screen-Shot-2015-12-06-at-12.03.57-AM.webp 1002w,\n/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/31d32/Screen-Shot-2015-12-06-at-12.03.57-AM.webp 1196w\"\n              sizes=\"(max-width: 668px) 100vw, 668px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/21521/Screen-Shot-2015-12-06-at-12.03.57-AM.png 167w,\n/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/86d36/Screen-Shot-2015-12-06-at-12.03.57-AM.png 334w,\n/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/74866/Screen-Shot-2015-12-06-at-12.03.57-AM.png 668w,\n/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/d69c4/Screen-Shot-2015-12-06-at-12.03.57-AM.png 1002w,\n/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/51800/Screen-Shot-2015-12-06-at-12.03.57-AM.png 1196w\"\n            sizes=\"(max-width: 668px) 100vw, 668px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/73b8ec3d43c8a9c7dab4dc1a70cb40ad/74866/Screen-Shot-2015-12-06-at-12.03.57-AM.png\"\n            alt=\"Scree\"\n            title=\"Scree\"\n            loading=\"lazy\"\n            decoding=\"async\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>Goのサーバを起動しておき、書かれているとおりにコマンドを実行します。</p>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre class=\"language-shell\"><code class=\"language-shell\">dredd init <span class=\"token comment\"># 省略,対話CLIがあります</span>\ndredd</code></pre></div>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 668px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/0de8689662ff1f7280815a18fb637a83/b3ad9/Screen-Shot-2015-12-06-at-1.25.59-AM.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 19.16167664670659%; position: relative; bottom: 0; left: 0; background-image: url('data:image/svg+xml,%3csvg%20xmlns=\\'http://www.w3.org/2000/svg\\'%20width=\\'400\\'%20height=\\'77\\'%20viewBox=\\'0%200%20400%2077\\'%20preserveAspectRatio=\\'none\\'%3e%3cpath%20d=\\'M0%2039v38h401V0H198v2l-1%203V2c0-2-2-3-2-1l-1%201V1l-1-1-1%201-1%202c-2%200-2-2-1-2%201-1-1-1-4-1-4%200-5%200-5%202l-1%202V2c0-2-1-2-4-2l-3%201v1h-1c0-2-2-2-15-2l-14%201h5l5%201c0%202-9%202-11%200l-1%201h-6c1%201%200%202-1%202l-1-2c0-2%201-2%203-2h5l-9-1c-5%200-9%200-8%201v2c-2%201-2%201-2-1s-1-2-3-2c-3%200-4%201-2%203v1l-2-2c0-2%200-2-2%201l-1%203V3l1-3h-9c-5%200-9%200-8%201l1%201h-1l-1%201-3%201-3-1h-1c-1%201-1%201-1-1l-1-2v2l-1%202-1-3-1-1-1%202v3l-1-3c-2-2-6-3-6%200h-1c0-2-1-2-6-2-6%200-7%200-8%203l-1%203%201-3-1-3c-1%200-2%201-1%202%200%202-2%203-5%203-2%200-1-4%201-4%202-1%202-1%200-1s-3%201-4%203c-1%203-2%203-1%200%200-3%200-3-6-3s-7%200-6%202c0%202%200%202-5%202s-5%200-5-2V0l-1%202-1%202-1-2-2-2c-2%200-3%201-3%203%200%203-2%203-2-1%200-2%200-2-1%200%200%203-3%203-3%200l-1-2v2l-1%202-1-2-1-2v2c0%202%200%202-2%202L6%202%205%200%204%203v2L3%203%202%200C0%200%200%205%200%2039\\'%20fill=\\'%23d3d3d3\\'%20fill-rule=\\'evenodd\\'/%3e%3c/svg%3e'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/0de8689662ff1f7280815a18fb637a83/5251b/Screen-Shot-2015-12-06-at-1.25.59-AM.webp 167w,\n/static/0de8689662ff1f7280815a18fb637a83/7390e/Screen-Shot-2015-12-06-at-1.25.59-AM.webp 334w,\n/static/0de8689662ff1f7280815a18fb637a83/7c056/Screen-Shot-2015-12-06-at-1.25.59-AM.webp 668w,\n/static/0de8689662ff1f7280815a18fb637a83/ed09a/Screen-Shot-2015-12-06-at-1.25.59-AM.webp 909w\"\n              sizes=\"(max-width: 668px) 100vw, 668px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/0de8689662ff1f7280815a18fb637a83/21521/Screen-Shot-2015-12-06-at-1.25.59-AM.png 167w,\n/static/0de8689662ff1f7280815a18fb637a83/86d36/Screen-Shot-2015-12-06-at-1.25.59-AM.png 334w,\n/static/0de8689662ff1f7280815a18fb637a83/74866/Screen-Shot-2015-12-06-at-1.25.59-AM.png 668w,\n/static/0de8689662ff1f7280815a18fb637a83/b3ad9/Screen-Shot-2015-12-06-at-1.25.59-AM.png 909w\"\n            sizes=\"(max-width: 668px) 100vw, 668px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/0de8689662ff1f7280815a18fb637a83/74866/Screen-Shot-2015-12-06-at-1.25.59-AM.png\"\n            alt=\"APIドキュメントでAPIサーバをテストする\"\n            title=\"APIドキュメントでAPIサーバをテストする\"\n            loading=\"lazy\"\n            decoding=\"async\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>↑こんな感じになります。<br>\nさらに、 <strong>Apiaryの言うとおりにdredd initしておくと、そのテストの通知結果が集約される</strong> ようになっています。</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 668px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/1eb260a63b174b7e90da5b7d14bd7187/29007/Screen-Shot-2015-12-06-at-1.27.02-AM.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 63.47305389221557%; position: relative; bottom: 0; left: 0; background-image: url('data:image/svg+xml,%3csvg%20xmlns=\\'http://www.w3.org/2000/svg\\'%20width=\\'400\\'%20height=\\'255\\'%20viewBox=\\'0%200%20400%20255\\'%20preserveAspectRatio=\\'none\\'%3e%3cpath%20d=\\'M117%207l39%201h39v34H98L1%2043h197v-7h47l46-1-46-1h-47V8h9l9-1-49-1-50%201M38%2017c-2%203-1%205%202%206%202%200%203%200%203-2h1c1%202%207%202%208%201h19l14%201c14%200%2014%200%2014-3-1-2-3-4-4-2-1%201-8%201-9-1h-5c0%201-1%202-4%201-3%200-4%200-4%202-1%201-1%200-1-1%200-3%200-3-2-2-1%202-1%202-2%200-2-1-2-1-2%201l-1%202-2-1H53l-1-2h-1c-1%202-5%202-5%201l-1-1h-7m0%2035c-2%201-1%204%201%205s3%200%204-2h1l1%202h3c0%201%201%201%202-1h1l1%201h8l3-1h1l1-1c0-2-7-3-10-2l-2-1c-2-1-2-1-2%201h-5c0-2%200-2-1-1h-7m28%202c0%202%200%203%201%202h4l7%201c6%200%207%200%206-1-2-1-2-1%200-1h3l2-1-1%202c-1%201-1%201%201%201h8c2%200%202-3%200-5h-3l-2%201h-4l-2-1h-6l-2%201h-3c0-1-1-1-2%201-1%201-1%201-1-1l-1-2-1%202-1%201-1-1-1-2-1%203m140%208c0%202%200%202%201%201h2c1%202%2011%202%2012%200h1c1%202%207%202%207-1l1%201h2c1%202%204%202%205-1%200-2%200-2-8-2a949%20949%200%2001-23%202M39%2086v1h-1l-1%202c1%203%205%204%206%201h1c1%202%205%202%206%201h13c2-2%202-2%200-3H53l-1-1h-6l-1-1h-6m42%200c0%201-1%202-2%201v1l1%202-2-1h-1l-1-1c0-2-3-1-3%201-1%201-1%201-1-1s-1-3-2-1h-2c-1-2-2-1-2%202%200%202%200%203%201%202h4l9%201c7%200%209-1%208-2v-1c1-1%201%200%201%201l1%201h1l4%201c3%200%204-1%204-3l-2-2c-1%201-1%201%200%200l-1-1-1%201c0%201-8%201-10-1h-4m-43%2035c-2%201-1%204%201%205s3%200%204-2h1l1%202h3c0%201%201%201%202-1h1l1%201h8l3-1h1l1-1c0-2-7-3-10-2l-2-1c-2-1-2-1-2%201h-5c0-2%200-2-1-1h-7m28%202c0%202%200%203%201%202h4l7%201c6%200%207%200%206-1-2-1-2-1%200-1h3l2-1-1%202c-1%201-1%201%201%201h8c2%200%202-3%200-5h-3l-2%201h-4l-2-1h-6l-2%201h-3c0-1-1-1-2%201-1%201-1%201-1-1l-1-2-1%202-1%201-1-1-1-2-1%203m154%204l1%205h15v-9h-16v4m140%201v4h16v-9h-16v5M39%20155v1h-1l-1%202c1%203%205%204%206%201h1c1%202%205%202%206%201h13c2-2%202-2%200-3H53l-1-1h-6l-1-1h-6m42%200c0%201-1%202-2%201v1l1%202-2-1h-1l-1-1c0-2-3-1-3%201-1%201-1%201-1-1s-1-3-2-1h-2c-1-2-2-1-2%202%200%202%200%203%201%202h4l9%201c7%200%209-1%208-2v-1c1-1%201%200%201%201l1%201h1l4%201c3%200%204-1%204-3l-2-2c-1%201-1%201%200%200l-1-1-1%201c0%201-8%201-10-1h-4m140%203l-1%205v4h21v-4c0-5-1-6-11-6l-9%201m139%205v4h16v-9h-16v5M38%20190c-2%201-1%204%201%205s3%200%204-2h1l1%202h3c0%201%201%201%202-1h1l1%201h8l3-1h1l1-1c0-2-7-3-10-2l-2-1c-2-1-2-1-2%201h-5c0-2%200-2-1-1h-7m28%202c0%202%200%203%201%202h4l7%201c6%200%207%200%206-1-2-1-2-1%200-1h3l2-1-1%202c-1%201-1%201%201%201h8c2%200%202-3%200-5h-3l-2%201h-4l-2-1h-6l-2%201h-3c0-1-1-1-2%201-1%201-1%201-1-1l-1-2-1%202-1%201-1-1-1-2-1%203m155%201l-1%205v4h21v-4c0-5-1-6-11-6l-9%201m139%205v4h16v-9h-16v5M39%20224v1h-1l-1%202c1%203%205%204%206%201h1c1%202%205%202%206%201h13c2-2%202-2%200-3H53l-1-1h-6l-1-1h-6m42%200c0%201-1%202-2%201v1l1%202-2-1h-1l-1-1c0-2-3-1-3%201-1%201-1%201-1-1s-1-3-2-1h-2c-1-2-2-1-2%202%200%202%200%203%201%202h4l9%201c7%200%209-1%208-2v-1c1-1%201%200%201%201l1%201h1l4%201c3%200%204-1%204-3l-2-2c-1%201-1%201%200%200l-1-1-1%201c0%201-8%201-10-1h-4m140%204l-1%205v4h21v-4c0-5-1-6-11-6l-9%201m139%205v4h16v-9h-16v5\\'%20fill=\\'%23d3d3d3\\'%20fill-rule=\\'evenodd\\'/%3e%3c/svg%3e'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/1eb260a63b174b7e90da5b7d14bd7187/5251b/Screen-Shot-2015-12-06-at-1.27.02-AM.webp 167w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/7390e/Screen-Shot-2015-12-06-at-1.27.02-AM.webp 334w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/7c056/Screen-Shot-2015-12-06-at-1.27.02-AM.webp 668w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/0a92e/Screen-Shot-2015-12-06-at-1.27.02-AM.webp 1002w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/7fa3c/Screen-Shot-2015-12-06-at-1.27.02-AM.webp 1336w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/fad48/Screen-Shot-2015-12-06-at-1.27.02-AM.webp 1600w\"\n              sizes=\"(max-width: 668px) 100vw, 668px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/1eb260a63b174b7e90da5b7d14bd7187/21521/Screen-Shot-2015-12-06-at-1.27.02-AM.png 167w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/86d36/Screen-Shot-2015-12-06-at-1.27.02-AM.png 334w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/74866/Screen-Shot-2015-12-06-at-1.27.02-AM.png 668w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/d69c4/Screen-Shot-2015-12-06-at-1.27.02-AM.png 1002w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/9685e/Screen-Shot-2015-12-06-at-1.27.02-AM.png 1336w,\n/static/1eb260a63b174b7e90da5b7d14bd7187/29007/Screen-Shot-2015-12-06-at-1.27.02-AM.png 1600w\"\n            sizes=\"(max-width: 668px) 100vw, 668px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/1eb260a63b174b7e90da5b7d14bd7187/74866/Screen-Shot-2015-12-06-at-1.27.02-AM.png\"\n            alt=\"APIドキュメントでAPIサーバをテストする\"\n            title=\"APIドキュメントでAPIサーバをテストする\"\n            loading=\"lazy\"\n            decoding=\"async\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>立てておいたGoのサーバに対してHTTPリクエストが飛び、どんなレスポンスが返ってきたかをテストしてくれます。<br>\nこれで実装が変わっても、ドキュメントが変わってもコマンド一つで整合性を確認できます。</p>\n<p>リクエストと対応するレスポンスのパターンを書けば書くほどテストケースが増えるので、<br>\n<strong>ドキュメントをしっかり書くことがテストのクオリティ向上、ひいてはプロダクトの質向上に繋がる</strong> ところが、ドキュメントを書くモチベに繋がるなと感じます。</p>\n<h2 id=\"githubと連携する\" style=\"position:relative;\"><a href=\"#github%E3%81%A8%E9%80%A3%E6%90%BA%E3%81%99%E3%82%8B\" aria-label=\"githubと連携する permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Githubと連携する</h2>\n<p>反映漏れや食い違いを起こさないために、<br>\nAPIドキュメントをGitで管理して、GithubのmasterにpushされたらApiaryのドキュメントに自動反映されるようにします。</p>\n<p>Apiaryのアカウント設定を開き、Githubのアカウントと紐付けます。</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 668px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/a04f778c10af90fadcc21d310f52d10f/5b481/Screen-Shot-2015-12-05-at-2.51.19-PM.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 59.2814371257485%; position: relative; bottom: 0; left: 0; background-image: url('data:image/svg+xml,%3csvg%20xmlns=\\'http://www.w3.org/2000/svg\\'%20width=\\'400\\'%20height=\\'238\\'%20viewBox=\\'0%200%20400%20238\\'%20preserveAspectRatio=\\'none\\'%3e%3cpath%20d=\\'M160%2048c-6%206%201%2015%208%2011%204-2%203-6-1-7l-3%201%202%202%201%201c0%202-4%201-5%200-2-3-1-6%203-7%205%200%205%200%204-1-2-3-7-2-9%200m50%205l1%206%203%201c3%200%206-2%206-6%200-2-3-5-6-4l-1-2-2-2-1%207M76%2055c1%205%203%207%203%201%201-5%203-5%205%200%202%203%202%204%200%205s-1%202%201%202%207-9%207-12c0-2-3-1-4%202l-1%203-1-3c-1-3-1-3-6-3h-4v5m-37%2092c-2%201-2%203-2%2018l1%2017h53c48%200%2053%200%2054-2%202-3%201-30-1-32-2-3-102-3-105-1\\'%20fill=\\'%23d3d3d3\\'%20fill-rule=\\'evenodd\\'/%3e%3c/svg%3e'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/a04f778c10af90fadcc21d310f52d10f/5251b/Screen-Shot-2015-12-05-at-2.51.19-PM.webp 167w,\n/static/a04f778c10af90fadcc21d310f52d10f/7390e/Screen-Shot-2015-12-05-at-2.51.19-PM.webp 334w,\n/static/a04f778c10af90fadcc21d310f52d10f/7c056/Screen-Shot-2015-12-05-at-2.51.19-PM.webp 668w,\n/static/a04f778c10af90fadcc21d310f52d10f/47c32/Screen-Shot-2015-12-05-at-2.51.19-PM.webp 846w\"\n              sizes=\"(max-width: 668px) 100vw, 668px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/a04f778c10af90fadcc21d310f52d10f/21521/Screen-Shot-2015-12-05-at-2.51.19-PM.png 167w,\n/static/a04f778c10af90fadcc21d310f52d10f/86d36/Screen-Shot-2015-12-05-at-2.51.19-PM.png 334w,\n/static/a04f778c10af90fadcc21d310f52d10f/74866/Screen-Shot-2015-12-05-at-2.51.19-PM.png 668w,\n/static/a04f778c10af90fadcc21d310f52d10f/5b481/Screen-Shot-2015-12-05-at-2.51.19-PM.png 846w\"\n            sizes=\"(max-width: 668px) 100vw, 668px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/a04f778c10af90fadcc21d310f52d10f/74866/Screen-Shot-2015-12-05-at-2.51.19-PM.png\"\n            alt=\"APIドキュメントでAPIサーバをテストする\"\n            title=\"APIドキュメントでAPIサーバをテストする\"\n            loading=\"lazy\"\n            decoding=\"async\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>Apiaryのドキュメントの設定を開き、Githubと連携させる設定をしておきます</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 668px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/e9a7d8279558a0d98e27ead8db5e2e40/76435/Screen-Shot-2015-12-06-at-1.05.14-AM.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 53.293413173652695%; position: relative; bottom: 0; left: 0; background-image: url('data:image/svg+xml,%3csvg%20xmlns=\\'http://www.w3.org/2000/svg\\'%20width=\\'400\\'%20height=\\'214\\'%20viewBox=\\'0%200%20400%20214\\'%20preserveAspectRatio=\\'none\\'%3e%3cpath%20d=\\'M171%203l1%203h133V0H171v3M71%20192v5h36l37-1-1-5c0-5%200-5-3-4h-14c0-1-11-2-11%200%200%201-3%201-7-1-1%200-2%200-2%202h-1c-1-2-2-2-3-1H81c0-2-4-1-5%201l-1%201-2-2c-2-1-2%200-2%205\\'%20fill=\\'%23d3d3d3\\'%20fill-rule=\\'evenodd\\'/%3e%3c/svg%3e'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/e9a7d8279558a0d98e27ead8db5e2e40/5251b/Screen-Shot-2015-12-06-at-1.05.14-AM.webp 167w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/7390e/Screen-Shot-2015-12-06-at-1.05.14-AM.webp 334w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/7c056/Screen-Shot-2015-12-06-at-1.05.14-AM.webp 668w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/0a92e/Screen-Shot-2015-12-06-at-1.05.14-AM.webp 1002w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/7fa3c/Screen-Shot-2015-12-06-at-1.05.14-AM.webp 1336w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/97499/Screen-Shot-2015-12-06-at-1.05.14-AM.webp 1742w\"\n              sizes=\"(max-width: 668px) 100vw, 668px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/e9a7d8279558a0d98e27ead8db5e2e40/21521/Screen-Shot-2015-12-06-at-1.05.14-AM.png 167w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/86d36/Screen-Shot-2015-12-06-at-1.05.14-AM.png 334w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/74866/Screen-Shot-2015-12-06-at-1.05.14-AM.png 668w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/d69c4/Screen-Shot-2015-12-06-at-1.05.14-AM.png 1002w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/9685e/Screen-Shot-2015-12-06-at-1.05.14-AM.png 1336w,\n/static/e9a7d8279558a0d98e27ead8db5e2e40/76435/Screen-Shot-2015-12-06-at-1.05.14-AM.png 1742w\"\n            sizes=\"(max-width: 668px) 100vw, 668px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/e9a7d8279558a0d98e27ead8db5e2e40/74866/Screen-Shot-2015-12-06-at-1.05.14-AM.png\"\n            alt=\"Scree\"\n            title=\"Scree\"\n            loading=\"lazy\"\n            decoding=\"async\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>Githubのリポジトリの設定を開き、Apiaryを選択します。</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 668px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/c82230ce0b1c9381af887d8e5773be2c/4971b/Screen-Shot-2015-12-05-at-2.52.55-PM.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 56.886227544910184%; position: relative; bottom: 0; left: 0; background-image: url('data:image/svg+xml,%3csvg%20xmlns=\\'http://www.w3.org/2000/svg\\'%20width=\\'400\\'%20height=\\'229\\'%20viewBox=\\'0%200%20400%20229\\'%20preserveAspectRatio=\\'none\\'%3e%3cpath%20d=\\'M259%2037c-2%205-2%205%200%205l1-1%202-1%201%201%202%201%201-2h1l4%202c3%200%203%200%203-5l-1-5-7%205c0%202%200%202-1-1-2-5-4-5-6%201m55-3v1c-1-1-2%200-3%201h-2l-4-2c-3%200-3%201-3%204l1%204%201-2c0-4%203-4%204-1%200%204%203%204%205%200l1-3v3c0%203%202%204%203%202h8c3%202%206%201%206-2%201-4-2-6-5-4-1%202-2%202-3%200-1-1-2-1-4%201-2%201-2%200-2-3l-2-1-1%202M105%2068l-1%202c0%202%200%202-1%201l-2-1-2-1-1-1-1%205c0%204%200%204%202%204l4-2h1c0%202%202%203%202%201h3c3%202%205%201%205-3-1-4-5-4-7%200v-1c0-4-1-6-2-4m44%203c-3%202%201%207%204%205h3c2%201%202%201%204-1s2-2%202%200c0%201%200%202%202%202%203%200%205-2%203-3v-3c0-1-4-2-6%200h-12M0%2090l5%205c14%209%2013%2029-1%2038-4%202-6%206-2%204%2018-6%2022-32%207-43-5-4-9-6-9-4m50%2062c0%204%200%206-2%207-3%201-3%208%200%209%202%200%202%201%202%206v5h304v-33H50v6m-28%208l-2%203c0%204%205%207%208%203%201-1%201-1-1-1h-4l3-1c4%200%207%203%205%204-3%201%201%203%204%203%202%200%203-1%203-6%200-6%200-6-3-6-2-1-3-1-4%201-2%202-2%202-3%200-2-2-4-3-6%200\\'%20fill=\\'%23d3d3d3\\'%20fill-rule=\\'evenodd\\'/%3e%3c/svg%3e'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/c82230ce0b1c9381af887d8e5773be2c/5251b/Screen-Shot-2015-12-05-at-2.52.55-PM.webp 167w,\n/static/c82230ce0b1c9381af887d8e5773be2c/7390e/Screen-Shot-2015-12-05-at-2.52.55-PM.webp 334w,\n/static/c82230ce0b1c9381af887d8e5773be2c/7c056/Screen-Shot-2015-12-05-at-2.52.55-PM.webp 668w,\n/static/c82230ce0b1c9381af887d8e5773be2c/2a3bb/Screen-Shot-2015-12-05-at-2.52.55-PM.webp 784w\"\n              sizes=\"(max-width: 668px) 100vw, 668px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/c82230ce0b1c9381af887d8e5773be2c/21521/Screen-Shot-2015-12-05-at-2.52.55-PM.png 167w,\n/static/c82230ce0b1c9381af887d8e5773be2c/86d36/Screen-Shot-2015-12-05-at-2.52.55-PM.png 334w,\n/static/c82230ce0b1c9381af887d8e5773be2c/74866/Screen-Shot-2015-12-05-at-2.52.55-PM.png 668w,\n/static/c82230ce0b1c9381af887d8e5773be2c/4971b/Screen-Shot-2015-12-05-at-2.52.55-PM.png 784w\"\n            sizes=\"(max-width: 668px) 100vw, 668px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/c82230ce0b1c9381af887d8e5773be2c/74866/Screen-Shot-2015-12-05-at-2.52.55-PM.png\"\n            alt=\"APIドキュメントでAPIサーバをテストする\"\n            title=\"APIドキュメントでAPIサーバをテストする\"\n            loading=\"lazy\"\n            decoding=\"async\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>domainのところには、Apiaryのドメインを設定します。写真の太字の箇所が入力すべき値です。</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 668px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/1e1b95fa3737c3816543e96ca215dfe0/51800/Screen-Shot-2015-12-05-at-2.53.30-PM.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 37.125748502994014%; position: relative; bottom: 0; left: 0; background-image: url('data:image/svg+xml,%3csvg%20xmlns=\\'http://www.w3.org/2000/svg\\'%20width=\\'400\\'%20height=\\'148\\'%20viewBox=\\'0%200%20400%20148\\'%20preserveAspectRatio=\\'none\\'%3e%3cpath%20d=\\'M172%20104v9l1%208h40v-18h-20l-21%201\\'%20fill=\\'%23d3d3d3\\'%20fill-rule=\\'evenodd\\'/%3e%3c/svg%3e'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/1e1b95fa3737c3816543e96ca215dfe0/5251b/Screen-Shot-2015-12-05-at-2.53.30-PM.webp 167w,\n/static/1e1b95fa3737c3816543e96ca215dfe0/7390e/Screen-Shot-2015-12-05-at-2.53.30-PM.webp 334w,\n/static/1e1b95fa3737c3816543e96ca215dfe0/7c056/Screen-Shot-2015-12-05-at-2.53.30-PM.webp 668w,\n/static/1e1b95fa3737c3816543e96ca215dfe0/0a92e/Screen-Shot-2015-12-05-at-2.53.30-PM.webp 1002w,\n/static/1e1b95fa3737c3816543e96ca215dfe0/31d32/Screen-Shot-2015-12-05-at-2.53.30-PM.webp 1196w\"\n              sizes=\"(max-width: 668px) 100vw, 668px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/1e1b95fa3737c3816543e96ca215dfe0/21521/Screen-Shot-2015-12-05-at-2.53.30-PM.png 167w,\n/static/1e1b95fa3737c3816543e96ca215dfe0/86d36/Screen-Shot-2015-12-05-at-2.53.30-PM.png 334w,\n/static/1e1b95fa3737c3816543e96ca215dfe0/74866/Screen-Shot-2015-12-05-at-2.53.30-PM.png 668w,\n/static/1e1b95fa3737c3816543e96ca215dfe0/d69c4/Screen-Shot-2015-12-05-at-2.53.30-PM.png 1002w,\n/static/1e1b95fa3737c3816543e96ca215dfe0/51800/Screen-Shot-2015-12-05-at-2.53.30-PM.png 1196w\"\n            sizes=\"(max-width: 668px) 100vw, 668px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/1e1b95fa3737c3816543e96ca215dfe0/74866/Screen-Shot-2015-12-05-at-2.53.30-PM.png\"\n            alt=\"Scree\"\n            title=\"Scree\"\n            loading=\"lazy\"\n            decoding=\"async\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<h2 id=\"まとめ\" style=\"position:relative;\"><a href=\"#%E3%81%BE%E3%81%A8%E3%82%81\" aria-label=\"まとめ permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>まとめ</h2>\n<p>API Blueprintはまだ発展途上で、<a href=\"https://github.com/apiaryio/api-blueprint/issues/11\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Authorizationに対応して欲しい</a>とかissueが上がっています。<br>\n他にもRate limitのテストなども、そもそもApi blueprintの仕様にその辺が存在しないので、別途テストを書くしかないと思います。</p>\n<p>など細かな問題が色々残っていますが、効率よく質良くAPIサーバとAPIドキュメントをメンテナンスしていくいい方法だと思いました。</p>\n<blockquote>\n<p><a href=\"http://www.publickey1.jp/blog/15/open_api_initiative.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RESTful APIの記述標準化を目指す「Open API Initiative」をマイクロソフト、Google、IBMらが立ち上げ。Swaggerをベースに － Publickey</a></p>\n</blockquote>\n<p>最後に。↑の記事の通り、先月くらいに<a href=\"https://openapis.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Open API Initiative</a>という団体が結成したようです。<br>\n名だたる企業たちがコアメンバーに入っているので、活動を追って行きたいと思います。</p>","timeToRead":8,"frontmatter":{"title":"APIドキュメントでAPIサーバをテストする","tags":["API","API Blueprint","Dredd","Go","Nodejs"],"date":"December 05, 2015","featuredImage":{"childImageSharp":{"fluid":{"tracedSVG":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='400'%20height='201'%20viewBox='0%200%20400%20201'%20preserveAspectRatio='none'%3e%3cpath%20d='M0%20101v100h401V0H0v101m214-78c0%205%201%206%203%206l2%201%203%201%203-1%202-1c2%200%203-1%203-6v-5l-8-1h-8v6m2-1v5h12v-8l-6-1h-6v4m140%2044c-4%205-3%2011%202%2014%204%202%209%201%2011-3%205-8-5-18-13-11M203%2082c-18%207-17%2032%201%2037%208%202%2015-1%2021-8%204-5%204-16-1-22-5-7-14-9-21-7m81%2050c-3%203-4%206-2%2010%204%207%2016%204%2016-4s-8-12-14-6m-151%200c-8%204-8%2016%200%2021s19-1%2019-10c0-10-11-16-19-11'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e","aspectRatio":1.9880952380952381,"src":"/static/70431038bb3b6ac4ca57a07366471d44/8eab8/featured-image.png","srcSet":"/static/70431038bb3b6ac4ca57a07366471d44/1ec58/featured-image.png 334w,\n/static/70431038bb3b6ac4ca57a07366471d44/ccb4a/featured-image.png 668w,\n/static/70431038bb3b6ac4ca57a07366471d44/8eab8/featured-image.png 1336w,\n/static/70431038bb3b6ac4ca57a07366471d44/11369/featured-image.png 1678w","srcWebp":"/static/70431038bb3b6ac4ca57a07366471d44/f7e47/featured-image.webp","srcSetWebp":"/static/70431038bb3b6ac4ca57a07366471d44/cd98f/featured-image.webp 334w,\n/static/70431038bb3b6ac4ca57a07366471d44/7535d/featured-image.webp 668w,\n/static/70431038bb3b6ac4ca57a07366471d44/f7e47/featured-image.webp 1336w,\n/static/70431038bb3b6ac4ca57a07366471d44/00e8a/featured-image.webp 1678w","sizes":"(max-width: 1336px) 100vw, 1336px"}}}}}},"pageContext":{"slug":"/how-to-test-api-server-with-api-spec/","previous":{"fields":{"slug":"/how-to-implement-frequency-ui-in-form/"},"frontmatter":{"title":"フォーム周りで地味に使うUIと実現方法","tags":["Advent Calendar","JavaScript","Qiita"]}},"next":{"fields":{"slug":"/how-to-validate-form-value-with-constraint-validation/"},"frontmatter":{"title":"HTML5のConstraint validationでライブラリ要らずならくらくバリデーション","tags":["Advent Calendar","HTML5 Constraint validation","JavaScript"]}}}},
    "staticQueryHashes": ["2585454260","2954598359"]}