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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Masaki Iino
November 17, 2017
Technology
750
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
Cursor Subagentsはいいぞ
yug1224
2
120
CloudFrontのHost Header転送設定でパケットの中身はどう変わるのか?
nagisa53
1
230
AI時代のIssue駆動開発のススメ
moongift
PRO
0
320
AI時代のオンプレ-クラウドキャリアチェンジ考
yuu0w0yuu
0
670
昔話で振り返るAWSの歩み ~S3誕生から20年、クラウドはどう進化したのか~
nrinetcom
PRO
0
120
【社内勉強会】新年度からコーディングエージェントを使いこなす - 構造と制約で引き出すClaude Codeの実践知
nwiizo
33
16k
Navigation APIと見るSvelteKitのWeb標準志向
yamanoku
2
130
脳が溶けた話 / Melted Brain
keisuke69
1
1.1k
QA組織のAI戦略とAIテスト設計システムAITASの実践
sansantech
PRO
1
270
Move Fast and Break Things: 10 in 20
ramimac
0
100
最大のアウトプット術は問題を作ること
ryoaccount
0
210
SaaSに宿る21g
kanyamaguc
2
180
Featured
See All Featured
The Curse of the Amulet
leimatthew05
1
11k
A Soul's Torment
seathinner
5
2.6k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
160
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
400
Automating Front-end Workflow
addyosmani
1370
200k
Accessibility Awareness
sabderemane
0
88
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
210
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
490
Making the Leap to Tech Lead
cromwellryan
135
9.8k
The Pragmatic Product Professional
lauravandoore
37
7.2k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
79
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 でタイポも防げる • 楽できる