Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
GolangでAPIドキュメント自動生成
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Masaki Iino
November 17, 2017
Technology
780
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GolangでAPIドキュメント自動生成
社内LT
Masaki Iino
November 17, 2017
Transcript
15 slides
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 でタイポも防げる • 楽できる
More Decks by Masaki Iino
See All by Masaki Iino
GCP Composer
iinomasaki
0
270
AnyPay ChatOps
iinomasaki
0
1.2k
Istio
iinomasaki
0
1.7k
LT_Cloud_Functions.pdf
iinomasaki
1
610
Other Decks in Technology
See All in Technology
【Oracle AI SPOTLIGHT ウェビナー】【特別開催:日本語で解説!】Oracle AI World 2026 最新情報フィードバック
oracle4engineer
PRO
1
280
信頼性を犠牲にせず、PR マージからデプロイまで人の介入を完全にゼロにするまでの道のり
knwoop
1
550
AI-Ready なデータ基盤ってなに? & 新卒未経験が、いま考えていること
imuta
0
670
AIで実装が加速したのに、 なぜ私は仕事の大半で人と話し続けていたのか?
say_no_w
0
190
WasmをRustにする技術
sansantech
PRO
1
120
変更差分を読むために環境を整備しよう
pipepasta
1
470
Del vibe coding a un Desarrollo (agéntico) fiable
jcabot
0
170
これからのデータエンジニアの役割について考える / Rethinking the Role of Data Engineers in the AI Era
okiyuki99
1
540
OCI Artifact による自動運転タクシーに向けた OTA 基盤の構築
biwashi
0
110
マネージャーをエスパーにしない マネジメントされる側から始める、働きやすい現場づくり
comi190327
1
790
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
1
530
gradle-best-practices 使ってみた
mikanichinose
0
160
Featured
See All Featured
Claude Code のすすめ
schroneko
67
230k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
300
Six Lessons from altMBA
skipperchong
29
4.6k
The agentic SEO stack - context over prompts
schlessera
0
1k
GraphQLとの向き合い方2022年版
quramy
50
15k
Designing Experiences People Love
moore
143
24k
Become a Pro
speakerdeck
PRO
31
6.4k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
250
Mind Mapping
helmedeiros
1
440
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
60k
How to make the Groovebox
asonas
2
2.6k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
69k