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
130
1
Share
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
More Decks by Alan Cooke
See All by Alan Cooke
Robots, the best testers your will ever ever build
a1cooke
0
52
ROBOTS, THE BEST TESTERS YOU WILL EVER BUILD
a1cooke
0
140
Tales of a rebuild
a1cooke
0
35
Modernizing Objective-C using Swift
a1cooke
0
93
GDG August 2015 - Retrofit + GSON
a1cooke
0
75
Other Decks in Programming
See All in Programming
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
250
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
300
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
220
今さら聞けないCancellationToken
htkym
0
210
Claspは野良GASの夢をみるか
takter00
0
150
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
410
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
110
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
7
2.9k
誰も頼んでない機能を出荷した話
zekutax
0
160
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
430
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
170
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
690
Featured
See All Featured
It's Worth the Effort
3n
188
29k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
840
First, design no harm
axbom
PRO
2
1.2k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
760
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
190
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
Un-Boring Meetings
codingconduct
0
300
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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