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
48
ROBOTS, THE BEST TESTERS YOU WILL EVER BUILD
a1cooke
0
140
Tales of a rebuild
a1cooke
0
33
Modernizing Objective-C using Swift
a1cooke
0
90
GDG August 2015 - Retrofit + GSON
a1cooke
0
71
Other Decks in Programming
See All in Programming
alien-signals と自作 OSS で実現する フレームワーク非依存な ロジック共通化の探求 / Exploring Framework-Agnostic Logic Sharing with alien-signals and Custom OSS
aoseyuu
2
790
Ktorで簡単AIアプリケーション
tsukakei
0
120
AkarengaLT vol.38
hashimoto_kei
1
130
品質ワークショップをやってみた
nealle
0
650
Introduce Hono CLI
yusukebe
6
3.2k
NixOS + Kubernetesで構築する自宅サーバーのすべて
ichi_h3
0
1.3k
あなたとKaigi on Rails / Kaigi on Rails + You
shimoju
0
220
EMこそClaude Codeでコード調査しよう
shibayu36
0
480
SODA - FACT BOOK(JP)
sodainc
1
8.9k
Webサーバーサイド言語としてのRustについて
kouyuume
1
5k
KoogではじめるAIエージェント開発
hiroaki404
1
150
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
580
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
GraphQLとの向き合い方2022年版
quramy
49
14k
What's in a price? How to price your products and services
michaelherold
246
12k
Code Review Best Practice
trishagee
72
19k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
630
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Six Lessons from altMBA
skipperchong
29
4k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.2k
How To Stay Up To Date on Web Technology
chriscoyier
791
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