Upload
muhammad-siddiqi
View
184
Download
8
Embed Size (px)
Citation preview
Muhammad Siddiqi
@SiddiqiMuhammad
alternatestack.comshujaat.net
About me…???
@SiddiqiMuhammad
AgendaAPI Economy
Issues with APIs
Swagger’s Introduction & History
Details about Swagger Spec
Degree of RESTfulness
Approaches for Swaggerizing
Swagger Alternatives
@SiddiqiMuhammad
Why so much interest in API Design?
code camps - # Sessions discussing API Design & Dev
What’s driving API Boom?
By 2019, more than 30 percent of the 100 largest vendors' new software investments will have shifted from cloud-first to cloud-only. Gartner - Jun’16
The worldwide Internet of Things market is predicted to grow to $1.7 trillion by 2020, marking a compound annual growth rate of 16.9%. IDC Worldwide Internet of Things Forecast, 2015 – 2020.
An estimated 25 billion connected “things” will be in use by 2020. – Gartner Newsroom
API Economy
@SiddiqiMuhammad
deux problèmes
مسائل دو
mavuto awiriבעיות שתי
兩個問題
Due problemi
مشكلتين
iki sorun
abụọ nsogbu
రెండు సమస్యలు
dua masalah
مشکل دو
Две проблемы
Dos problemas
Two problems
@SiddiqiMuhammad
Pain for developers
Using an REST API
As a consumer
As a provider
Available UrisParameters?Payloads
Supporting user is hardMaintaining API documentation is difficult
@SiddiqiMuhammad
Distributed MonolithBen Christensen
models lib models lib
The Platform Libraries required to run services / Libraries to interact with services
“The evils of too much coupling between services are far worse than the problems caused by code duplication”Sam Newman(Building Microservices)
Central Authority Technical evolution of teams
Polyglot Development Not possible
When a service cannot interact within a system unless all these libraries are available.
Per Conway’s Law, affects design
Extreme Programming DRY Principle Overdoing can result in Distributed Monolith
string jsonResponse = @"{ 'Name': 'Bad Boys', 'ReleaseDate': '1995-4-7T00:00:00', 'Genres': [ 'Action', 'Comedy' ]}";
Movie m = JsonConvert.DeserializeObject<Movie>(json);
How to solve this??
leverage contracts and protocols
@SiddiqiMuhammad
Swagger
- Defines Interface to REST API
- Language agnostic
- API Specs / API Docs —-> JSON / YAML format
- No guesswork in calling the service
- Contract for REST Service
OpenAPI
SpecSwagger
Eco-system
- Documenting RESTful APIs
- Open sourced
@SiddiqiMuhammad
It has been there for a while…
wordnik —-> SmartBear
Open API Initiative -> working group under Linux foundation
Swagger 2.0 is Open API Spec… Next version -> de-swaggered and would be called OAS 3.0
@SiddiqiMuhammad
Many good people are behind it?
Discussion about Spec
Metadata about API (name, description, host, basepath, …)
ResourcesParametersResponsesUnderlying Data ModelSecurity
@SiddiqiMuhammad
Discussion about Spec
Metadata about API (name, description, host, basepath, …)
ResourcesParametersResponsesUnderlying Data ModelSecurity
@SiddiqiMuhammad
Discussion about Spec
Metadata about API (name, description, host, basepath, …)
ResourcesParametersResponsesUnderlying Data ModelSecurity
@SiddiqiMuhammad
Swagger Structure - Data Types
@SiddiqiMuhammad
- - - -- - - -- - - -
API Spec
Service Code
Client code
Swagger tools
Contract First
- - - -- - - -- - - -
API Spec
Client code
Swagger tools
Code First
Service(Swagger-helper api)
Approaches for Swagger-izing APIs
ClientServer
http
@SiddiqiMuhammad
Swagger Community
Google Group
IRC Channel : #swagger
http://apiawards.co/
@SiddiqiMuhammad
Is my API RESTful?
Can this be answered as Yes / No?
Are there degree of RESTfulness?
April
0 20 40 60 80 100
Level 0: Swamp of POX
Level 1: Resources
Level 2: HTTP Verbs
Level 3: HATEOAS
Richardson’s Maturity Model
Swagger 2.0
OpenAPI.next
@SiddiqiMuhammad
Swagger.Ed
Graphical Representation of API
chrome extension @chefarchitect
@SiddiqiMuhammad
OpenAPI.next
Breaking change… :(
Hypermedia support
Extended JSON Schema support… any of, not operators
Callback style events / non request / response drivenHTTP 2.0 and socket techniques
WebHooksServer could tell what sort of signatures are needed. Consumer sending message back. [subscription, un-subscription, retry]
@SiddiqiMuhammad
Service First / Code First
scalatra-swagger"com.wordnik" %% "swagger-play2"
ASP.Net Web API —- > Swashbuckle
Automated API Spec Generation?
swagger-node-express
SpringFox -> Automated JSON API documentation for API's built with Spring
@SiddiqiMuhammad
Spec First / Contract FirstSwagger.io Editor Restlet
SwaggerHub
@SiddiqiMuhammad
Validating Swagger Spec
Swagger Validator Badge
<img src="http://online.swagger.io/validator?url={YOUR_URL}">
@SiddiqiMuhammad
Client Code GenerationAPI Operations
Model Classes
AutorestNSwagswagger-codegeneditor.swagger.ioRestletAPIMATIC
@SiddiqiMuhammad
swagger-codegen generate -l html -i https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json
Documentation for Developers
swagger-ui
swagger-codegen
asciidoctor?? — Swagger2Markup
@SiddiqiMuhammad
Dynamic Client Code GenerationSwaggerProvider: F# type providerSergey Tihon
Javascript
Python
@SiddiqiMuhammad
Where to find API Specs
@SiddiqiMuhammad
Swagger and Postman
Postman collections can be generated
@SiddiqiMuhammad
Swagger Alternatives
@SiddiqiMuhammad
Thank You!
@SiddiqiMuhammad
@SiddiqiMuhammad