Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Design First Web APIs - OpenAPI 3
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Roger Camargo
June 02, 2021
Programming
130
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Design First Web APIs - OpenAPI 3
Design first web APIs and why Django did not help!
Roger Camargo
June 02, 2021
Transcript
30 slides
Design first APIs and why Django did not help! by
Roger Camargo - Jun/2021
Design first APIs and why Django did not help! WEB
by Roger Camargo - Jun/2021
DISCLAIMER
Why API?
Backend Data Frontend API Code is the documentation. (It’s okay)
👉
Backend Data Client 1 API Client 2 Where is the
API documentation? 👉
Backend Data Client 1 API System A SDK Client JS
System B Client 2
Backend Data Client 1 API Client 2 System A SDK
Client JS System B Internet It can be hard to keep an API documentation updated... 👉
How to use your API? What are the endpoints? Methods?
Status codes??
How to use your API? What are the endpoints? Methods?
Status codes?? https://http.cat/
/users Code-First, Write Docs "When We Have Time" 👉 It
means "We will not write documentation"
201 API Specs/Docs
👉 It can fail to maintain parity between our documentation
and our underlying implementation API Specs/Docs
OpenAPI Specification (OAS3)
What is OAS3? - Contract for defining RESTful APIs -
Source of truth for everyone - Open source, evolving standard - Collection of tools - Language-agnostic - Readable by both humans and machines
What is OAS3? - Design by contract (YAML) (The pragmatic
programmer) - Get feedback on the API before coding - Easier to make changes - One source of truth - Generate code, mock, tests, docs etc...
Wait... Big design up front?
https://editor.swagger.io/ 👉 One source of truth
https://github.com/zalando/connexion 👉
Low coupling, High cohesion
api.py YAML service.py (CONTRACT) Routes Request validation Response validation Schema
casting FACADE API Layer Business Layer DATA ORM
Django land...
Models Managers TEMPLATE FILTERS Exception Middlewares View Exception Handlers
/polls/
Django It’s hard to produce API Guided by the YAML
contract...
However, there is django-ninja DOCS Code first, but there is
an API documentation 👉
The design first way… (Flask, Falcon etc…)
Automatic live documentation API Mock server Frontend For quick UX
validation Quick feedback Frontend TEAM Backend TEAM Real Implementation API Tests Business Tests Minimize the ReWork YAML
Design first API Links: https://swagger.io/resources/webinars/adopting-a-design-first-approach/ https://apisyouwonthate.com/blog/api-design-first-vs-code-first https://docs.djangoproject.com/en/3.2/ref/request-response/ https://www.openapis.org/ https://github.com/zalando/connexion https://http.cat/
Tools: https://editor.swagger.io/ https://stoplight.io/ Code sample: https://github.com/billcode/jarless Books https://www.goodreads.com/book/show/4099.The_Pragmatic_Programmer
THANK YOU Keep in touch @huogerac https://huogerac.hashnode.dev
[email protected]
https://speakerdeck.com/huogerac
More Decks by Roger Camargo
See All by Roger Camargo
AWS Lambda, Rodar local, com testes, IaC e Deploy via ansible
huogerac
1
53
Mapa de estudo dev frontend 2023
huogerac
1
100
Documentando API no Django com django-ninja
huogerac
1
140
Um pouco da origem para chegar no WSGI
huogerac
0
65
"API Design First" pt-br
huogerac
0
290
3 Arquiteturas Django
huogerac
1
360
Django ORM vs SQLAlchemy (queries)
huogerac
0
220
Django ORM vs SQLAlchemy (intro)
huogerac
0
120
Site Imobiliario Django
huogerac
0
130
Other Decks in Programming
See All in Programming
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
700
JavaScriptはシングルバイナリの夢を見るか / Does JavaScript Dream of a Single Binary?
ssssota
0
130
Claude Codeのおかげでやりたいことがやれるようになったんだよォー!
sms_tech
0
190
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
AIコーディングをセッションで終わらせない: PHPライブラリ開発におけるコンテキスト承継設計
ickx
0
110
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
450
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
220
AppFunctionsの内部実装を紐解く
hiroaki404
0
120
Kotlin JVM用に作られたライブラリのKMPを前提とした再設計
jsoizo
0
230
祈るテストから、探索するテストへ 〜Lincheckではじめる並行処理テスト〜
yyh_gl
0
430
protojson における文字化けの扱い
kazuki1023
0
460
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
670
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
56
10k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
690
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
370
My Coaching Mixtape
mlcsv
0
390
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.3k
The Art of Programming - Codeland 2020
erikaheidi
57
15k