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
GolangでAPIドキュメント自動生成
Search
Masaki Iino
November 17, 2017
Technology
760
0
Share
GolangでAPIドキュメント自動生成
社内LT
Masaki Iino
November 17, 2017
More Decks by Masaki Iino
See All by Masaki Iino
GCP Composer
iinomasaki
0
260
AnyPay ChatOps
iinomasaki
0
1.2k
Istio
iinomasaki
0
1.7k
LT_Cloud_Functions.pdf
iinomasaki
1
590
Other Decks in Technology
See All in Technology
Diagnosing performance problems without the guesswork
elenatanasoiu
0
120
GitHub Copilot のこれまでとこれから: From Copilot to Collaborative Agents
yuriemori
1
230
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
1.8k
oracle-to-databricks-migration-with-llm-and-dbt
casek
1
370
APIテストとは?
nagix
0
160
Gradle×GitHub_ActionsでCI時間を約50%短縮 ジョブ分割の設計と落とし穴 / Cutting CI Time by ~50% with Gradle and GitHub Actions: Job-Splitting Design and Pitfalls
takatty
0
530
Terraformモジュールは、なぜ「魔境」化するのか
hayama17
1
120
組織の中で自分を経営する技術
shoota
0
220
Amazon Bedrock 経由の Claude Cowork を試してみよう・MCP にも繋いでみよう
sugimomoto
0
250
開発を止めない CI/CD ~CI Visibilityによる継続的最適化~
pensuke628
0
200
Dynamic Workersについて
yusukebe
1
450
インフラが苦手でも大丈夫! 紙芝居 Kubernetes -WWGT 10周年編-
aoi1
1
310
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
270
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
850
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Transcript
GolangでAPIドキュメント自動 生成 2017/11/17 飯野 雅希
APIドキュメント書いてますか?
APIドキュメントは書くのが大変 • Host • Path • HTTPメソッド • Request Header,
Body • Query Parameter • Response Status Code • Response Header, Body • etc...
書き手と読み手が違う • 書くのはサーバーエンジニア • 読むのはフロント・クライアントエンジニア
APIドキュメンテーションツール • Swagger • apiblueprint
API Blueprint • Markdownを使って定義を書く ◦ 拡張子は.apib • Markdownそのままでも読みやすい
API Blueprint • 基本情報 ◦ タイトル ◦ ホスト • グループ
• endopoint情報 ◦ HTTPメソッド ◦ endpoint ◦ リクエスト ◦ パラメータ ◦ レスポンス
読みやすく高機能
だけど、手書きで管理し続けるのは大変
ドキュメントを自動生成しよう 要件 • Golangでコード書いたらapiblueprintでドキュメント自動生成 • apibファイルだとviewerがいるので、HTMLに変換
apiblueprint生成 test2doc:https://github.com/adams-sarah/test2doc • GolangのPackage • Star 236 • Unitテストと組み合わせると自動でAPIドキュメントを生成してくれる
test2doc
test2doc
HTMLに変換 Gulpスクリプトで変換 https://storage.googleapis.com/iino-test-api-doc-test/out.html
所感 • 自動で生成されるのでコードとドキュメントの乖離がなくなる • Go lint/vet でタイポも防げる • 楽できる