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
Design First Web APIs - OpenAPI 3
Search
Roger Camargo
June 02, 2021
Programming
1
76
Design First Web APIs - OpenAPI 3
Design first web APIs and why Django did not help!
Roger Camargo
June 02, 2021
Tweet
Share
More Decks by Roger Camargo
See All by Roger Camargo
Mapa de estudo dev frontend 2023
huogerac
1
66
Documentando API no Django com django-ninja
huogerac
1
95
Um pouco da origem para chegar no WSGI
huogerac
0
22
"API Design First" pt-br
huogerac
0
240
3 Arquiteturas Django
huogerac
1
220
Django ORM vs SQLAlchemy (queries)
huogerac
0
150
Django ORM vs SQLAlchemy (intro)
huogerac
0
85
Site Imobiliario Django
huogerac
0
81
CMS Django com magic content
huogerac
0
99
Other Decks in Programming
See All in Programming
선언형 UI에서의 상태관리
l2hyunwoo
0
230
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
260
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
300
Recoilを剥がしている話
kirik
5
7.7k
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
5
1.2k
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
120
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
700
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
430
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
160
iOS開発におけるCopilot For XcodeとCode Completion / copilot for xcode
fuyan777
1
710
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
760
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1.1k
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Faster Mobile Websites
deanohume
305
30k
Optimizing for Happiness
mojombo
376
70k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
Gamification - CAS2011
davidbonilla
80
5.1k
How to train your dragon (web standard)
notwaldorf
88
5.8k
GitHub's CSS Performance
jonrohan
1031
460k
Docker and Python
trallard
43
3.2k
Code Reviewing Like a Champion
maltzj
521
39k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Transcript
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