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
250
AnyPay ChatOps
iinomasaki
0
1.2k
Istio
iinomasaki
0
1.6k
LT_Cloud_Functions.pdf
iinomasaki
1
580
Other Decks in Technology
See All in Technology
明日からドヤれる!超マニアックなAWSセキュリティTips10連発 / 10 Ultra-Niche AWS Security Tips
yuj1osm
0
540
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
4.3k
マルチプロダクトの信頼性を効率良く保っていくために
kworkdev
PRO
0
140
Digitization部 紹介資料
sansan33
PRO
1
7.3k
ハーネスエンジニアリングをやりすぎた話 ~そのハーネスは解体された~
gotalab555
2
1.2k
レビューしきれない?それは「全て人力でのレビュー」だからではないでしょうか
amixedcolor
0
290
Snowflake Intelligence導入で 分かった活用のコツ
wonohe
0
120
Azure Speech で音声対応してみよう
kosmosebi
0
160
ARIA Notifyについて
ryokatsuse
1
120
みんなで作るAWS Tips 100連発 (FinOps編)
schwrzktz
1
280
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
290
AIエージェントの権限管理 1: MCPサーバー・ツールの Fine grained access control 編
ren8k
3
490
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9.3k
The Curious Case for Waylosing
cassininazir
0
300
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
170
Paper Plane
katiecoart
PRO
1
49k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
890
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
270
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.4k
Ethics towards AI in product and experience design
skipperchong
2
250
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
190
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
290
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
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 でタイポも防げる • 楽できる