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
5分くらいでわかるSwagger / 5minutes-swagger
Search
Takumi Endo
November 09, 2015
Programming
1
1.5k
5分くらいでわかるSwagger / 5minutes-swagger
Takumi Endo
November 09, 2015
Tweet
Share
More Decks by Takumi Endo
See All by Takumi Endo
ヒトとクルマと業務をつなげるコネクテッドカーサービス「Cariot」のAPI/Cariot API
tqjappy
2
3.4k
Introduction to Modern Java
tqjappy
6
8.9k
Writing Nice Code
tqjappy
1
760
Other Decks in Programming
See All in Programming
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
900
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
210
良いユニットテストを書こう
mototakatsu
7
2.2k
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
Symfony Mapper Component
soyuka
2
730
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
720
fs2-io を試してたらバグを見つけて直した話
chencmd
0
230
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
210
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
750
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
130
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
270
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
It's Worth the Effort
3n
183
28k
Code Review Best Practice
trishagee
65
17k
Documentation Writing (for coders)
carmenintech
66
4.5k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Designing for humans not robots
tammielis
250
25k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Automating Front-end Workflow
addyosmani
1366
200k
Optimizing for Happiness
mojombo
376
70k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Transcript
Swagger 5͘Β͍ͰΘ͔Δ T. Endo
http://swagger.io/
4XBHHFS w 3&45GVM"1*υΩϡϝϯτ࡞ͷͨΊ ͷϑϨʔϜϫʔΫ w +40/PS:".-Ͱ"1*༷Λॻ͘ ʢ4XBHHFS4QFDJpDBUJPOɺҎԼɺ4XBHHFS4QFDʣ w 0QFO"1**OJUJBUJWFͰ࠾༻
4XBHHFS 4QFD +40/:".- ίʔυ +BWB 1)1ʣ ! 4XBHHFS6* "84"1*(BUFXBZ ֎෦࿈ܞ
4XBHHFS $PEFHFO ಡΈࠐΈ "NB[PO"1* (BUFXBZ*NQPSUFS ΤίγεςϜ 4XBHHFS&EJUPS ʢΦϯϥΠϯΤσΟλʣ
4XBHHFS4QFDΛॻ͘ w 4XBHHFS&EJUPS IUUQFEJUPSTXBHHFSJP ɾΦϯϥΠϯΤσΟλ ʢ͍׳ΕͨΤσΟλͰॻ͍ͯՄʣ ɾ݁ߏϝϞϦΛ͏ ɹ$ISPNF͕ϝϞϦෆͰ ɹམͪΔ͜ͱʜ ϦΞϧλΠϜʹө
ɾهड़ͨ͠༰ίʔυ 4%, ɹ4XBHHFS4QFDͷ ɹΤΫεϙʔτ͕Ͱ͖Δ
4XBHHFS6* ͜ͷϑΥʔϜ͔ zVSMzΫΤϦύϥϝʔλʹ TXBHHFSTQFDͷ63-Λ ॻ͘ ॻ͍ͨ4XBHHFS4QFD͕ ʮ7"-*%ʯͰ͋Δ͜ͱΛ ֬ೝ
ʮ5SZJUPVUʯ "1*Λ࣮ߦͯ͠ ࢼ͢͜ͱ͕Ͱ͖Δ ʢΫϩεΦϦδϯʣ
4XBHHFS4QFDͷ จ๏
4XBHHFS4QFDͷֶͼํ w IUUQTXBHHFSJPTQFDJpDBUJPO w ݱόʔδϣϯ w طଘͷαϯϓϧΛݟ֮ͯ͑Δͷ͕ۙಓ ! w ֶशίετ͍ʢͱࢥ͏ʣ
ʢ"NB[PO"1*(BUFXBZ*NQPSUFSͷ UTUSFTPVSDFTTXBHHFSҎԼͷϑΝΠϧͱ͔͓͢͢Ίʣ
4XBHHFS4QFDͷߏ جຊใ swagger ! info! host! schemes! basePath! tags! produces
"1*ఆٛ Ϟσϧఆٛ paths definitions \ \ \ ˞ඞਢ߲ ʢʣ͜ΕͰશͯͰͳ͍Ͱ͢
جຊใ swagger: '2.0'! info:! title: Sample API! description: Swagger Sample!
host: xxx.sample.jp! schemes:! - https! basePath: /api! tags:! - name: User! description: Ϣʔβ! produces:! - application/json :".-Ͱͷྫ ʢجຊ+40/Ͱಉ͡ʣ IUUQ IUUQT XT XTTͷ ͲΕ͔
Ϟσϧఆٛ ϦΫΤετϨεϙϯεͰ͏σʔλܕΛϞσϧͱͯ͠ఆ͍ٛͯ͘͠ ˞JE OBNF BHFͱ͍͏ ͭͷϑΟʔϧυΛͭ 6TFSϞσϧΛఆٛ͢Δྫ definitions:! User:! type:
object! properties:! id:! type: integer! description: id of user! name:! type: string! description: name of user! age:! type: number! description: age of user Ϟσϧ໊
paths:! /users/{id}:! get:! summary: get user list! description: xxx! parameters:!
- name: id! in: path! required: false! type: integer! tags:! - User! responses:! '200'! description: user list! schema:! $ref: '#/definitions/User' "1*ఆٛ ఆٛͨ͠6TFS ϞσϧΛฦ͢ RVFSZ IFBEFS QBUI CPEZ GPSN%BUBͷ ͲΕ͔ )551ϝιου )551Ϩεϙϯεͷ ఆٛྻڍ