Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GolangでAPIドキュメント自動生成
Search
Masaki Iino
November 17, 2017
Technology
0
730
GolangでAPIドキュメント自動生成
社内LT
Masaki Iino
November 17, 2017
Tweet
Share
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
570
Other Decks in Technology
See All in Technology
新 Security HubがついにGA!仕組みや料金を深堀り #AWSreInvent #regrowth / AWS Security Hub Advanced GA
masahirokawahara
1
2k
手動から自動へ、そしてその先へ
moritamasami
0
300
re:Inventで気になったサービスを10分でいけるところまでお話しします
yama3133
1
120
AIと二人三脚で育てた、個人開発アプリグロース術
zozotech
PRO
1
730
Challenging Hardware Contests with Zephyr and Lessons Learned
iotengineer22
0
210
MapKitとオープンデータで実現する地図情報の拡張と可視化
zozotech
PRO
1
140
生成AI活用の型ハンズオン〜顧客課題起点で設計する7つのステップ
yushin_n
0
160
Sansanが実践する Platform EngineeringとSREの協創
sansantech
PRO
2
860
Fashion×AI「似合う」を届けるためのWEARのAI戦略
zozotech
PRO
2
470
打 造 A I 驅 動 的 G i t H u b ⾃ 動 化 ⼯ 作 流 程
appleboy
0
330
ログ管理の新たな可能性?CloudWatchの新機能をご紹介
ikumi_ono
1
740
Jakarta Agentic AI Specification - Status and Future
reza_rahman
0
100
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.6k
Visualization
eitanlees
150
16k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
970
A better future with KSS
kneath
240
18k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Building Adaptive Systems
keathley
44
2.9k
Designing for Performance
lara
610
69k
A Tale of Four Properties
chriscoyier
162
23k
The World Runs on Bad Software
bkeepers
PRO
72
12k
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 でタイポも防げる • 楽できる