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
APIドキュメント標準化現状確認 / standard api document
Search
mat
June 15, 2016
Technology
0
12k
APIドキュメント標準化現状確認 / standard api document
Excite Japan Co., Ltd.
Lightning Talks
mat
June 15, 2016
Tweet
Share
More Decks by mat
See All by mat
Amazon Echoのウェイクワードをカスタマイズする / Customize Amazon Echo Wake Word
romiogaku
0
420
プリキュアハッカソン4 成果発表 / cure_hack4
romiogaku
0
840
Other Decks in Technology
See All in Technology
【NW X Security JAWS#3】L3-4:AWS環境のIPv6移行に向けて知っておきたいこと
shotashiratori
0
260
On Your Data を超えていく!
hirotomotaguchi
2
690
Google Cloud の AI を支える裏側のインフラを垣間見る!
maroon1st
0
350
LangSmith入門―トレース/評価/プロンプト管理などを担うLLMアプリ開発プラットフォーム
os1ma
3
180
自己改善からチームを動かす! 「セルフエンジニアリングマネージャー」のすゝめ
shoota
6
720
GrafanaMeetup_AmazonManagedGrafanaのアクセス制御機能とマルチテナント環境下でのアクセス制御について
daitak
0
230
LLM開発・活用の舞台裏@2024.04.25
yushin_n
1
290
本当のAWS基礎
toru_kubota
0
520
データベース02: データベースの概念
trycycle
0
160
レガシーをぶっ壊せ。AEONで始めるDevRelの話 / Qiita Night 2024-2-22
aeonpeople
3
1.3k
JAWS-UG Bedrock Claude Night
yamahiro
3
610
元インフラエンジニアに成る / Human Resources to Human Relations
bobtani
4
920
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
13
4.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
121
39k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
659
120k
The Pragmatic Product Professional
lauravandoore
25
5.8k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
How to name files
jennybc
65
93k
Testing 201, or: Great Expectations
jmmastey
28
6.4k
GitHub's CSS Performance
jonrohan
1025
450k
The Cost Of JavaScript in 2023
addyosmani
16
3.9k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
7
1k
Rebuilding a faster, lazier Slack
samanthasiow
73
8.2k
Transcript
APIυΩϡϝϯτඪ४Խ ݱঢ়֬ೝ ϝϯόʔγοϓαʔϏεຊ෦ ࿀Ѫ݁ࠗɾ࿀׆ٕज़ηΫγϣϯ দԼ
API༷ॻ͘ͱ͖ Ͳ͏ͯ͠·͔͢ʁ
ԿͰॻ͘ʁ • Markdown • Githubͷwiki • Confluence • excel •
word
ԿΛॻ͘ʁ • HTTPϝιουʢGET/POST/PUT/DELETE…ʣ • ΤϯυϙΠϯτ • ϦΫΤετύϥϝʔλ • Ϩεϙϯε •
αϯϓϧ
ߏͱऍ
ຊޠ/ӳޠͰॻ͘ʹ ੍͕ແ͗͢͞Δ
༷ॻͷݟ͢͞ ॻ͖खʹࠨӈ͞ΕΔ
APIυΩϡϝϯτΛ هड़͢Δҝͷ ϧʔϧ/ݴޠ͕ඞཁͩ
APIυΩϡϝϯτΛ هड़͢Δҝͷ ϧʔϧ/ݴޠΛ౷Ұ͠Α͏
http://techslides.com/top-10-free-templates-for-api-documenation
͍Ζ͍ΖͰ͖ͯͨ
APIυΩϡϝϯτ ࡾॐ࢜Λ࿈Ε͖ͯͨΑ
ࠓͳΒ͜ͷ3͔ͭ • API Blueprint • RAML • Swagger
ͬ͘͟ͱղઆ͠·͢
ྫɿϒϩάهࣄৄࡉऔಘAPI ϦΫΤετ )551ϝιου ΤϯυϙΠϯτ ϦΫΤετ ύϥϝʔλ ϦΫΤετ ϔομ (&5 WBSUJDMF\BSUJDMF@JE^
BSUJDMF@JE ʢඞਢʣ $POUFOU5ZQFBQQMJDBUJPOKTPO "DDFQUBQQMJDBUJPOKTPO
{ "data": { "id": 3, "title": "هࣄλΠτϧ", "body": "<html>HTMLຊจ</html>", "created_at":
"2016-05-22T14:56:29.000Z", "updated_at": "2016-05-22T14:56:28.000Z", "author": "author1", "tags": [ {"id": 1, "tag_name": "λά໊1"}, {"id": 2, "tag_name": "λά໊2"} ] } } ྫɿϒϩάهࣄऔಘAPI Ϩεϙϯε(200)
API Blueprint
API Blueprint • MarkdownΛ֦ுͨ͠هड़ • JSON SchemaཪͰ࡞ͬͯ͘ΕΔ • JSON SchemaɿJSONσʔλߏΛهड़͢Δ
ͨΊͷॻࣜɾ༷ʢࠓճ৮Ε·ͤΜʣ
+ Request (application/json) + Headers Accept: application/json + Parameters +
article_id: 3 (number, required) + Response 200 (application/json) + Attributes + data (required) + id: 3 (number, required) + title: هࣄλΠτϧ (string, required) + body: `<html>HTMLຊจ</html>`(string, required) + created_at: `2016-05-22T14:56:29.000Z` (string, required) + updated_at: `2016-05-22T14:56:28.000Z` (string, required) + author: author1 (string, required) -- هࣄຖʹҰਓͷϢʔβʢஶऀʣ + tags (array) -- هࣄຖʹෳͷλά + (object) + id: 1 (number, required) + tag_name: λά1 (string, required) + (object) + id: 2 (number, required) + tag_name: λά2 (string, required) blog.apib(Ұ෦ൈਮ)
API Blueprint • Markdownͱݴ͍ͭͭบ͕͋Δ • ҰͭͰॻ͚ίϐϖͰͳΜͱ͔ͳΔ • ϑΝΠϧׂػೳ͕ͳ͍ͷͰͪ͜ΒͰ݁߹͢ ΔͳΓ͢Δඞཁ͕͋Δ •
APIυΩϡϝϯτੜπʔϧͷapiary͕༏ल
None
None
None
RAML
RAML • YAMLΛ֦ுͨ͠ه๏ • ڞ௨෦Λ࠶ར༻ͨ͠ΓɺଞͷϑΝΠϧ͔Β includeͨ͠ΓͰ͖Δ
schemas: - article: !include sampleblog-include-article.schema resourceTypes: - collection-item: description: Entity
representing a <<resourcePathName|!singularize>> get: responses: 200: body: application/json: schema: <<resourcePathName|!singularize>> example: | <<exampleItem>> /article: /{article_id}: uriParameters: article_id: description: هࣄID type: integer required: true example: 3 type: collection-item: exampleItem: !include sampleblog-include-article-item.sample description: هࣄ୯ମ get: description: هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ༻͠ɺهࣄຖͷauthor,tagใฦ٫͢Δ blog.raml(Ұ෦)
schemas: - article: !include sampleblog-include-article.schema resourceTypes: - collection-item: description: Entity
representing a <<resourcePathName|!singularize>> get: responses: 200: body: application/json: schema: <<resourcePathName|!singularize>> example: | <<exampleItem>> /article: /{article_id}: uriParameters: article_id: description: هࣄID type: integer required: true example: 3 type: collection-item: exampleItem: !include sampleblog-include-article-item.sample description: هࣄ୯ମ get: description: هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ༻͠ɺهࣄຖͷauthor,tagใฦ٫͢Δ blog.raml(Ұ෦)
schemas: - article: !include sampleblog-include-article.schema resourceTypes: - collection-item: description: Entity
representing a <<resourcePathName|!singularize>> get: responses: 200: body: application/json: schema: <<resourcePathName|!singularize>> example: | <<exampleItem>> /article: /{article_id}: uriParameters: article_id: description: هࣄID type: integer required: true example: 3 type: collection-item: exampleItem: !include sampleblog-include-article-item.sample description: هࣄ୯ମ get: description: هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ༻͠ɺهࣄຖͷauthor,tagใฦ٫͢Δ blog.raml(Ұ෦)
RAML • Լखʹܧঝ͕ؔఆٛͰ͖Δ͍ͤͰপʹ·Γͦ͏ • yamlͰແཧ͠ա͗Ͱɾɾɾʁ • 0.8ͱ1.0Ͱهड़݁ߏҧ͏ • json schemaͷ༷͓ͬͯ͘ඞཁ͕͋Δ
• apiaryʹࣅͨʮAPI Designerʯͱ͍͏αʔϏε͕͑Δ • AtomϓϥάΠϯ(API Workbench)͋Γ·͢
Swagger
Swagger • 3ͭͷதͰ࠷ݹࢀ • ༷ˠ࣮ͷτοϓμϯɺɹɹɹɹɹɹɹ ࣮ˠ༷ͷϘτϜΞοϓͷ྆ํʹରԠ • JSON͔YAMLͰ༷(Swagger Spec)Λॻ͘
swagger: '2.0' host: sampleblog.com basePath: /v1 paths: /article/{article_id}: get: summary:
هࣄৄࡉ description: | هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ༻͠ɺهࣄຖͷauthor,tagใฦ٫͢Δ parameters: - name: article_id in: path description: هࣄID required: true type: number tags: - Article responses: 200: description: هࣄৄࡉ schema: $ref: '#/definitions/Article' swagger.yaml(Ұ෦)
swagger: '2.0' host: sampleblog.com basePath: /v1 paths: /article/{article_id}: get: summary:
هࣄৄࡉ description: | هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ༻͠ɺهࣄຖͷauthor,tagใฦ٫͢Δ parameters: - name: article_id in: path description: هࣄID required: true type: number tags: - Article responses: 200: description: هࣄৄࡉ schema: $ref: '#/definitions/Article' swagger.yaml(Ұ෦)
definitions: Article: type: object required: - id - title -
body - created_at - updated_at - author - tags properties: id: type: number description: هࣄID title: type: string description: هࣄλΠτϧ body: type: string description: HTMLຊจ created_at: type: string format: datetime description: ࡞࣌ updated_at: type: string format: datetime description: ߋ৽࣌ author: type: string swagger.yaml(ଓ͖,Ұ෦ൈਮ)
Swagger • ؔ࿈πʔϧ͕ଟ͘ɺ3ͭͷதͰҰ൪ଟػೳ • ͱ͖ͬͭʹ͘͞No.1 • มʹڽͬͯͳ͍ͷͰ͍֮͑͢ʢͱࢥ͏ʣ • ʮSwagger CodegenʯͰαʔόStub/ΫϥΠΞϯτίʔυΛ
ు͖ग़ͤΔ • BetaͰapiaryରԠ͍ͯ͠Δ͕ɺʮSwagger Editorʯ͕͑Δ
None
ͲΕΛ͑ɾɾɾ
͍ͷʹר͔Ε·͠ΐ͏
GoogleτϨϯυ
Open API Initiative • RESTFul APIͷΠϯλʔϑΣʔεΛهड़͢Δͨ Ίͷඪ४ϑΥʔϚοτΛਪਐ͢Δஂମ • 2015ɺLinux FoundationڠྗͷԼ݁
• SwaggerΛ࠾༻
Open API Initiative
Swagger͕উͪͦ͏ʁ
νʔϜͰ͍͍͢ͷΛ ͍·͠ΐ͏
͓ΘΓ