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
Stop writing your API clients by hand
Search
Alan Cooke
August 22, 2018
Programming
1
130
Stop writing your API clients by hand
Introduction and demo of how one can use the Open API Spec to generate API clients on demand.
Alan Cooke
August 22, 2018
Tweet
Share
More Decks by Alan Cooke
See All by Alan Cooke
Robots, the best testers your will ever ever build
a1cooke
0
47
ROBOTS, THE BEST TESTERS YOU WILL EVER BUILD
a1cooke
0
140
Tales of a rebuild
a1cooke
0
32
Modernizing Objective-C using Swift
a1cooke
0
89
GDG August 2015 - Retrofit + GSON
a1cooke
0
68
Other Decks in Programming
See All in Programming
SODA - FACT BOOK
sodainc
1
860
イベントストーミングから始めるドメイン駆動設計
jgeem
4
830
Passkeys for Java Developers
ynojima
3
850
関数型まつり2025登壇資料「関数プログラミングと再帰」
taisontsukada
2
800
TypeScript LSP の今までとこれから
quramy
1
500
技術懸念に立ち向かい 法改正を穏便に乗り切った話
pop_cashew
0
1.4k
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
1
660
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
110
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
0
3k
レガシーシステムの機能調査・開発におけるAI利活用
takuya_ohtonari
0
590
Enterprise Web App. Development (2): Version Control Tool Training Ver. 5.1
knakagawa
1
110
ASP.NETアプリケーションのモダナイズ インフラ編
tomokusaba
1
220
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1031
460k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
Optimizing for Happiness
mojombo
379
70k
Producing Creativity
orderedlist
PRO
346
40k
Code Review Best Practice
trishagee
68
18k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
The Pragmatic Product Professional
lauravandoore
35
6.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.8k
Typedesign – Prime Four
hannesfritz
42
2.7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
43
2.4k
Transcript
Stop writing your API clients by hand
None
Alan Cooke — Senior Staff Engineer, Mobile
None
None
None
Open API aka Swagger — Open standard — Machine readable
— Language agnostic approach to API specification
None
Path specification paths: /v2/track: post: operationId: Track summary: Track tags:
- Event consumes: - application/json parameters: - name: body in: body schema: $ref: '#/definitions/Event' responses: '200': description: '' security: - X-Outbound-Key: []
Model specification definitions: User: title: User type: object properties: user_id:
type: string first_name: type: string last_name: type: string email: type: string required: - user_id
Security schemes securityDefinitions: X-Outbound-Key: name: X-Outbound-Key type: apiKey in: header
Tooling — Open source tools — Node service you run
locally or hosting service, allows you edit and mock APIs — Commercial tooling — Stoplight.io
Code generators — Open Source repo: https://github.com/swagger-api/ swagger-codegen/ Project broken
into two parts 1. Command Line Interface - swagger-codegen-cli 1. Code generator - swagger-codegen
Writing your own generator 1. Java class, allows you todo
any special pre/post processing of models 2. Collection of mustache template files used to translate model into code
public struct {{classname}}: Codable { {{#allVars}} {{#description}}/** {{description}} */ {{/description}}public
var {{name}}: {{{datatype}}} {{^required}}?{{/required}} {{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} {{/allVars}} }
None
Demo
Questions
None