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
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
Jakarta EE meets AI
ivargrimstad
0
620
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
100
Better Code Design in PHP
afilina
PRO
0
130
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
910
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
Amazon Qを使ってIaCを触ろう!
maruto
0
410
subpath importsで始めるモック生活
10tera
0
300
CSC509 Lecture 11
javiergs
PRO
0
180
Featured
See All Featured
Being A Developer After 40
akosma
86
590k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
880
Building an army of robots
kneath
302
43k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Automating Front-end Workflow
addyosmani
1366
200k
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Ϩεϙϯεͷ ఆٛྻڍ