SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
API Docs Made Right
or yet another API modelling rant
Meta: About Us
Dmitry Nazarov
Vladimir Shulyak
Meta: Contents
Part 1: Overview
Why you should care
History of API DLs
API DLs overview
Part 2: Technical
The Joel Boris test
Takeaways
Meta: Assumptions
Either you:
● Haven’t heard of API DLs / Not convinced it’s useful
● Having trouble choosing suitable DL
● Are using API DL in your project
We tried to cover all the basics
What’s an API DL?
API Description Languages 101
A structured document in YAML, JSON, Markdown with API definitions
API definition approaches:
● Top-down – create API definition first, in a separate release cycle
● Bottom-up – create API first, then describe/auto-generate definition
Mocking – a way to create a mock API from its definition
So why do we need those fancy
API DLs?
Benefits from business POV
Efficient and predictable collaboration with API model (Top-Down approach):
● Expectation gaps between API producers and consumers
● External teams/subcontractors have clear specs
API modelling helps in team load distribution (Top-Down approach):
● Any available party can start modelling the API, others join later
● Mocking enables writing code before the actual implementation is ready
Benefits from developer POV
Interfaces/Constraints first leads to better code
More potential issues discovered with iterative API design as a first stage
Natural way to document your project
It’s all started a while ago...
...with XML goodness
WSDL
WADL
+XSD
WADL example
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<resources base="http://api.search.yahoo.com/NewsSearchService/V1/">
<resource path="newsSearch">
<method name="GET" id="search">
<request>
<param name="appid" type="xsd:string" style="query" required="true"/>
<param name="query" type="xsd:string" style="query" required="true"/>
<param name="type" style="query" default="all">
<option value="all"/>
<option value="any"/>
<option value="phrase"/>
</param>
<param name="results" style="query" type="xsd:int" default="10"/>
<param name="language" style="query" type="xsd:string"/>
</request>
<response status="200">
<representation mediaType="application/xml" element="yn:ResultSet"/>
</response>
</method>
</resource>
</resources>
</application>
A.S. Years: After Swagger Era
Swagger 1.0
RAML 0.8 RAML 1.0 RC2
Swagger 1.2 Swagger 2.0
2011 2012 2013 2014 2015 2016
RAML 1.0 RC1
Swagger 1.1
API Blueprint 1A API Blueprint 1A5 API Blueprint 1A9
Open API
API DLs Hype Curve
You are here
Swagger vs RAML
Swagger
Swagger / Open API
Started as a tool for Wordnik
Model historically in JSON and YAML later
Both Bottom-Up (1.0) and Top-Down (1.0/2.0) approaches to modelling
Reuse: referencing, but capabilities are superficial
Nowadays a base of Open API initiative (Google, IBM, Intuit, Microsoft)
Swagger 2.0 Example
paths:
/pets:
get:
description: "Returns all pets"
produces:
- "application/json"
responses:
"200":
description: "A list of pets."
schema:
type: "array"
items:
$ref: "#/definitions/Pet"
definitions:
Pet:
type: "object"
required:
- "id"
- "name"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
tag:
type: "string"
Swagger Community and Tooling
Highly active community
Used by: Hootsuite, Zalando, possibly you
Tools:
● Swagger UI. Documenation generation
● Swagger Editor. Clould editor
RAML
RAML
Created by MuleSoft, but has a workgroup
YAML based
Top-down approach
Data types/schemas definition within RAML (1.0)
Reuse: resource types and traits
RAML 1.0 Example
types:
Pet:
type: object
required:
- id
- name
properties:
id: number
name: string
tag: string
/pets:
get:
description: “Returns all pets”
responses:
200:
description: “A list of pets”
body:
application/json:
schema: Pet
RAML Community and Tooling
Not as active as Swagger
Used by: Spotify, VMWare, less popular than Swagger, but has traction anyway
Tools: later on in this talk
...But which one should I use?
Swagger is great, but we bet on RAML
Swagger has a great community and tooling
But RAML has great tools as well!
RAML embraces pattern usage and code reuse
Used RAML in 3 big projects, happy so far
Any DL is better than no DL
The Joel Test: 12 Steps to Better Code
It’s a classic list of simple questions
You’re getting clear overview of how good your software
team is
We had an idea to make something similar
The Boris Test
9 Steps to better API documentation
1. Do you use hypermedia type to define
responses?
Data Definition Languages (DDLs): data modelling, data
validation
Hypermedia Types: a way to link API endpoints,
documentation, potential actions, and related endpoints
1. Do you use hypermedia type to define
responses?
HAL
Collection+JSON
JSON Hyperschema
Plenty of them suits RAML
JSON-LD
Hydra
Siren
Based on the concepts from XML Schemas (XSD)
..but JSON-based
Self-describing, readable
Same serialization/deserialization tools both for the
schema and data
JSON Schema
JSON Schema Response Example
{
"title": "Example Schema",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": [
"firstName",
"lastName"
]
}
A specification for building APIs in JSON
Achieving shared expectations
Free from limitations of contestants (HAL, ..)
JSON API
JSON API: Example response
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/articles/1/author"
},
"data": {
"type": "people",
"id": "9"
}
},
"comments": {
<..>
}
},
"links": {
"self": "http://example.com/articles/1"
}
2. Do you have your API design tools set up?
Editing RAML: autocomplete, test, visualize, validate
IDEs (API Workbench, API Designer)
plugins (YAML)
Editing JSON Schemas: generators
For end user
● the structure matches your API
● helps to start working with API quickly
..and for developer:
● sharing schemas
● getting schemas via http / as a submodule, reusing them
3. Do you organize your documentation
properly?
4. Do you take advantage of reusable RAML
constructions?
Keeping it DRY matters
● includes: inline one files to another
● resource types: reuse structures of methods
● traits: reuse attributes (auth/search/sort/..)
5. Is your documentation interactive for end
user?
API Console: visualize structure, provide in-browser
testing
API Notebook: JS scripting workspace; versioned,
forkable and shareable API use cases
Speeds up the development
6. Does your whole team collaborate on API
design?
The usual issues in flow of team interaction
It needs to be done async-way
You should also be able to walk any direction
6. Does your whole team collaborate on API
design?
The role of API documentation here: providing clear
and persistent feedback loop
Mocking as an essential part
Which is easy for you
7. Do you automate test & validation of
requests and responses?
Not enough to just have doc and schemas
Perform validation automatically on test run
Schemas as a linking element of the system
7. Do you automate test & validation of
requests and responses?
Data for test requests (and examples):
● writing manually (fixtures)
● generating it automatically (factories)
What’s wrong with fixtures
..and with factories
8. Do you have your documentation up to
date and easily accessible to the team?
Private and public APIs
Builded (into html), served (via http)
..on demand locally, automatically on CI..
Automate to the max (+ autoreload, autoopen)
9. Does your API itself follows best
practices?
● stable
● flexible
● secure
● <..>
● properly versionated
● throttled
● fast
Takeaways
Lots of daily pain removed
Good for new devs joining: dive fast, water is clear
Manually write JSON requests/responses less, generate it more
Attention to maintentence. The whole thing gets outdated
Use the tools and automate everything to be productive
Grazie mille

Weitere ähnliche Inhalte

Was ist angesagt?

AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEAN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEGavin Pickin
 
API-first development
API-first developmentAPI-first development
API-first developmentVasco Veloso
 
Ibm_interconnect_restapi_workshop
Ibm_interconnect_restapi_workshopIbm_interconnect_restapi_workshop
Ibm_interconnect_restapi_workshopShubhra Kar
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsJorge Ferrer
 
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...apidays
 
Moving into API documentation writing
Moving into API documentation writingMoving into API documentation writing
Moving into API documentation writingEllis Pratt
 
apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svr...
apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svr...apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svr...
apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svr...apidays
 
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...apidays
 
Level 3 REST Makes Your API Browsable
Level 3 REST Makes Your API BrowsableLevel 3 REST Makes Your API Browsable
Level 3 REST Makes Your API BrowsableMatt Bishop
 
Mocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with PostmanMocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with PostmanNordic APIs
 
API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards   25-6-2014API Athens Meetup - API standards   25-6-2014
API Athens Meetup - API standards 25-6-2014Michael Petychakis
 
Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Tony Tam
 
STC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachSTC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachLois Patterson
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Peter Hendriks
 
Using RAML 1.0 Like a Pro
Using RAML 1.0 Like a ProUsing RAML 1.0 Like a Pro
Using RAML 1.0 Like a ProMuleSoft
 
Write Generic Code with the Tooling API
Write Generic Code with the Tooling APIWrite Generic Code with the Tooling API
Write Generic Code with the Tooling APIAdam Olshansky
 

Was ist angesagt? (19)

AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEAN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
 
API-first development
API-first developmentAPI-first development
API-first development
 
Ibm_interconnect_restapi_workshop
Ibm_interconnect_restapi_workshopIbm_interconnect_restapi_workshop
Ibm_interconnect_restapi_workshop
 
Mule raml
Mule ramlMule raml
Mule raml
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
 
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
 
Moving into API documentation writing
Moving into API documentation writingMoving into API documentation writing
Moving into API documentation writing
 
apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svr...
apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svr...apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svr...
apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svr...
 
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
 
Level 3 REST Makes Your API Browsable
Level 3 REST Makes Your API BrowsableLevel 3 REST Makes Your API Browsable
Level 3 REST Makes Your API Browsable
 
Mocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with PostmanMocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with Postman
 
API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards   25-6-2014API Athens Meetup - API standards   25-6-2014
API Athens Meetup - API standards 25-6-2014
 
Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)
 
STC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachSTC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based Approach
 
What is Swagger?
What is Swagger?What is Swagger?
What is Swagger?
 
How to define an api
How to define an apiHow to define an api
How to define an api
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)
 
Using RAML 1.0 Like a Pro
Using RAML 1.0 Like a ProUsing RAML 1.0 Like a Pro
Using RAML 1.0 Like a Pro
 
Write Generic Code with the Tooling API
Write Generic Code with the Tooling APIWrite Generic Code with the Tooling API
Write Generic Code with the Tooling API
 

Andere mochten auch

Building APIs with Node.js and Swagger
Building APIs with Node.js and SwaggerBuilding APIs with Node.js and Swagger
Building APIs with Node.js and SwaggerJeremy Whitlock
 
"Big Data for Development: Opportunities & Challenges” - UN Global Pulse
"Big Data for Development: Opportunities & Challenges” - UN Global Pulse"Big Data for Development: Opportunities & Challenges” - UN Global Pulse
"Big Data for Development: Opportunities & Challenges” - UN Global PulseUN Global Pulse
 
Big Data, Social Networks & Human Behavior (Jukka-Pekka Onnela)
Big Data, Social Networks & Human Behavior (Jukka-Pekka Onnela)Big Data, Social Networks & Human Behavior (Jukka-Pekka Onnela)
Big Data, Social Networks & Human Behavior (Jukka-Pekka Onnela)UN Global Pulse
 
Understanding how to use Swagger and its tools
Understanding how to use Swagger and its toolsUnderstanding how to use Swagger and its tools
Understanding how to use Swagger and its toolsSwagger API
 
OpenAPI Specification概要
OpenAPI Specification概要OpenAPI Specification概要
OpenAPI Specification概要Kazuchika Sekiya
 
Swagger / Quick Start Guide
Swagger / Quick Start GuideSwagger / Quick Start Guide
Swagger / Quick Start GuideAndrii Gakhov
 
Design Driven API Development
Design Driven API DevelopmentDesign Driven API Development
Design Driven API DevelopmentSokichi Fujita
 
API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...SmartBear
 
Monetizing Big Data at Telecom Service Providers
Monetizing Big Data at Telecom Service ProvidersMonetizing Big Data at Telecom Service Providers
Monetizing Big Data at Telecom Service ProvidersDataWorks Summit
 
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...John Musser
 

Andere mochten auch (12)

Building APIs with Node.js and Swagger
Building APIs with Node.js and SwaggerBuilding APIs with Node.js and Swagger
Building APIs with Node.js and Swagger
 
"Big Data for Development: Opportunities & Challenges” - UN Global Pulse
"Big Data for Development: Opportunities & Challenges” - UN Global Pulse"Big Data for Development: Opportunities & Challenges” - UN Global Pulse
"Big Data for Development: Opportunities & Challenges” - UN Global Pulse
 
Big Data, Social Networks & Human Behavior (Jukka-Pekka Onnela)
Big Data, Social Networks & Human Behavior (Jukka-Pekka Onnela)Big Data, Social Networks & Human Behavior (Jukka-Pekka Onnela)
Big Data, Social Networks & Human Behavior (Jukka-Pekka Onnela)
 
Understanding how to use Swagger and its tools
Understanding how to use Swagger and its toolsUnderstanding how to use Swagger and its tools
Understanding how to use Swagger and its tools
 
OpenAPI Specification概要
OpenAPI Specification概要OpenAPI Specification概要
OpenAPI Specification概要
 
Swagger / Quick Start Guide
Swagger / Quick Start GuideSwagger / Quick Start Guide
Swagger / Quick Start Guide
 
Design Driven API Development
Design Driven API DevelopmentDesign Driven API Development
Design Driven API Development
 
Swagger 入門
Swagger 入門Swagger 入門
Swagger 入門
 
API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...
 
Monetizing Big Data at Telecom Service Providers
Monetizing Big Data at Telecom Service ProvidersMonetizing Big Data at Telecom Service Providers
Monetizing Big Data at Telecom Service Providers
 
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
 
RESTful API Design, Second Edition
RESTful API Design, Second EditionRESTful API Design, Second Edition
RESTful API Design, Second Edition
 

Ähnlich wie API Docs Made Right / RAML - Swagger rant

Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPeter Hendriks
 
API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards 25-6-2014API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards 25-6-2014openi_ict
 
“Fighting with giants - GraphQL soft adoption at Revolut” by Andrii Los
“Fighting with giants - GraphQL soft adoption at Revolut” by Andrii Los“Fighting with giants - GraphQL soft adoption at Revolut” by Andrii Los
“Fighting with giants - GraphQL soft adoption at Revolut” by Andrii LosIlyaDmitriev11
 
GraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsGraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsSashko Stubailo
 
Introduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeopleIntroduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeopleSpringPeople
 
Fed Up Of Framework Hype Dcphp
Fed Up Of Framework Hype DcphpFed Up Of Framework Hype Dcphp
Fed Up Of Framework Hype DcphpTony Bibbs
 
Zen and the Art of REST API documentation - MuCon London 2015
Zen and the Art of REST API documentation - MuCon London 2015Zen and the Art of REST API documentation - MuCon London 2015
Zen and the Art of REST API documentation - MuCon London 2015Steve Judd
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description LanguagesAkana
 
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...apidays
 
Ruby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupRuby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupJose de Leon
 
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and SparkVital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and SparkVital.AI
 
Backend Development Bootcamp - Node [Online & Offline] In Bangla
Backend Development Bootcamp - Node [Online & Offline] In BanglaBackend Development Bootcamp - Node [Online & Offline] In Bangla
Backend Development Bootcamp - Node [Online & Offline] In BanglaStack Learner
 
How to Design and Build a Great Web API
How to Design and Build a Great Web APIHow to Design and Build a Great Web API
How to Design and Build a Great Web APILaunchAny
 
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...Indus Khaitan
 

Ähnlich wie API Docs Made Right / RAML - Swagger rant (20)

Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIs
 
API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards 25-6-2014API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards 25-6-2014
 
“Fighting with giants - GraphQL soft adoption at Revolut” by Andrii Los
“Fighting with giants - GraphQL soft adoption at Revolut” by Andrii Los“Fighting with giants - GraphQL soft adoption at Revolut” by Andrii Los
“Fighting with giants - GraphQL soft adoption at Revolut” by Andrii Los
 
Resume
ResumeResume
Resume
 
GraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsGraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer tools
 
Empathic API-Design
Empathic API-DesignEmpathic API-Design
Empathic API-Design
 
Introduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeopleIntroduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeople
 
GraphQL Europe Recap
GraphQL Europe RecapGraphQL Europe Recap
GraphQL Europe Recap
 
Fed Up Of Framework Hype Dcphp
Fed Up Of Framework Hype DcphpFed Up Of Framework Hype Dcphp
Fed Up Of Framework Hype Dcphp
 
Zen and the Art of REST API documentation - MuCon London 2015
Zen and the Art of REST API documentation - MuCon London 2015Zen and the Art of REST API documentation - MuCon London 2015
Zen and the Art of REST API documentation - MuCon London 2015
 
Web servicesoverview
Web servicesoverviewWeb servicesoverview
Web servicesoverview
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description Languages
 
Web servicesoverview
Web servicesoverviewWeb servicesoverview
Web servicesoverview
 
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
 
Ruby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupRuby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User Group
 
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and SparkVital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
 
Backend Development Bootcamp - Node [Online & Offline] In Bangla
Backend Development Bootcamp - Node [Online & Offline] In BanglaBackend Development Bootcamp - Node [Online & Offline] In Bangla
Backend Development Bootcamp - Node [Online & Offline] In Bangla
 
Software Development with PHP & Laravel
Software Development  with PHP & LaravelSoftware Development  with PHP & Laravel
Software Development with PHP & Laravel
 
How to Design and Build a Great Web API
How to Design and Build a Great Web APIHow to Design and Build a Great Web API
How to Design and Build a Great Web API
 
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
 

Kürzlich hochgeladen

How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 

Kürzlich hochgeladen (20)

How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

API Docs Made Right / RAML - Swagger rant

  • 1. API Docs Made Right or yet another API modelling rant
  • 2. Meta: About Us Dmitry Nazarov Vladimir Shulyak
  • 3. Meta: Contents Part 1: Overview Why you should care History of API DLs API DLs overview Part 2: Technical The Joel Boris test Takeaways
  • 4. Meta: Assumptions Either you: ● Haven’t heard of API DLs / Not convinced it’s useful ● Having trouble choosing suitable DL ● Are using API DL in your project We tried to cover all the basics
  • 6. API Description Languages 101 A structured document in YAML, JSON, Markdown with API definitions API definition approaches: ● Top-down – create API definition first, in a separate release cycle ● Bottom-up – create API first, then describe/auto-generate definition Mocking – a way to create a mock API from its definition
  • 7. So why do we need those fancy API DLs?
  • 8. Benefits from business POV Efficient and predictable collaboration with API model (Top-Down approach): ● Expectation gaps between API producers and consumers ● External teams/subcontractors have clear specs API modelling helps in team load distribution (Top-Down approach): ● Any available party can start modelling the API, others join later ● Mocking enables writing code before the actual implementation is ready
  • 9. Benefits from developer POV Interfaces/Constraints first leads to better code More potential issues discovered with iterative API design as a first stage Natural way to document your project
  • 10. It’s all started a while ago...
  • 11.
  • 13. WADL example <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <resources base="http://api.search.yahoo.com/NewsSearchService/V1/"> <resource path="newsSearch"> <method name="GET" id="search"> <request> <param name="appid" type="xsd:string" style="query" required="true"/> <param name="query" type="xsd:string" style="query" required="true"/> <param name="type" style="query" default="all"> <option value="all"/> <option value="any"/> <option value="phrase"/> </param> <param name="results" style="query" type="xsd:int" default="10"/> <param name="language" style="query" type="xsd:string"/> </request> <response status="200"> <representation mediaType="application/xml" element="yn:ResultSet"/> </response> </method> </resource> </resources> </application>
  • 14.
  • 15. A.S. Years: After Swagger Era Swagger 1.0 RAML 0.8 RAML 1.0 RC2 Swagger 1.2 Swagger 2.0 2011 2012 2013 2014 2015 2016 RAML 1.0 RC1 Swagger 1.1 API Blueprint 1A API Blueprint 1A5 API Blueprint 1A9 Open API
  • 16. API DLs Hype Curve You are here
  • 19. Swagger / Open API Started as a tool for Wordnik Model historically in JSON and YAML later Both Bottom-Up (1.0) and Top-Down (1.0/2.0) approaches to modelling Reuse: referencing, but capabilities are superficial Nowadays a base of Open API initiative (Google, IBM, Intuit, Microsoft)
  • 20. Swagger 2.0 Example paths: /pets: get: description: "Returns all pets" produces: - "application/json" responses: "200": description: "A list of pets." schema: type: "array" items: $ref: "#/definitions/Pet" definitions: Pet: type: "object" required: - "id" - "name" properties: id: type: "integer" format: "int64" name: type: "string" tag: type: "string"
  • 21. Swagger Community and Tooling Highly active community Used by: Hootsuite, Zalando, possibly you Tools: ● Swagger UI. Documenation generation ● Swagger Editor. Clould editor
  • 22. RAML
  • 23. RAML Created by MuleSoft, but has a workgroup YAML based Top-down approach Data types/schemas definition within RAML (1.0) Reuse: resource types and traits
  • 24. RAML 1.0 Example types: Pet: type: object required: - id - name properties: id: number name: string tag: string /pets: get: description: “Returns all pets” responses: 200: description: “A list of pets” body: application/json: schema: Pet
  • 25. RAML Community and Tooling Not as active as Swagger Used by: Spotify, VMWare, less popular than Swagger, but has traction anyway Tools: later on in this talk
  • 26. ...But which one should I use?
  • 27. Swagger is great, but we bet on RAML Swagger has a great community and tooling But RAML has great tools as well! RAML embraces pattern usage and code reuse Used RAML in 3 big projects, happy so far Any DL is better than no DL
  • 28. The Joel Test: 12 Steps to Better Code It’s a classic list of simple questions You’re getting clear overview of how good your software team is We had an idea to make something similar
  • 29. The Boris Test 9 Steps to better API documentation
  • 30.
  • 31. 1. Do you use hypermedia type to define responses? Data Definition Languages (DDLs): data modelling, data validation Hypermedia Types: a way to link API endpoints, documentation, potential actions, and related endpoints
  • 32. 1. Do you use hypermedia type to define responses? HAL Collection+JSON JSON Hyperschema Plenty of them suits RAML JSON-LD Hydra Siren
  • 33. Based on the concepts from XML Schemas (XSD) ..but JSON-based Self-describing, readable Same serialization/deserialization tools both for the schema and data JSON Schema
  • 34. JSON Schema Response Example { "title": "Example Schema", "type": "object", "properties": { "firstName": { "type": "string" }, "lastName": { "type": "string" }, "age": { "description": "Age in years", "type": "integer", "minimum": 0 } }, "required": [ "firstName", "lastName" ] }
  • 35. A specification for building APIs in JSON Achieving shared expectations Free from limitations of contestants (HAL, ..) JSON API
  • 36. JSON API: Example response "relationships": { "author": { "links": { "self": "http://example.com/articles/1/relationships/author", "related": "http://example.com/articles/1/author" }, "data": { "type": "people", "id": "9" } }, "comments": { <..> } }, "links": { "self": "http://example.com/articles/1" }
  • 37. 2. Do you have your API design tools set up? Editing RAML: autocomplete, test, visualize, validate IDEs (API Workbench, API Designer) plugins (YAML) Editing JSON Schemas: generators
  • 38. For end user ● the structure matches your API ● helps to start working with API quickly ..and for developer: ● sharing schemas ● getting schemas via http / as a submodule, reusing them 3. Do you organize your documentation properly?
  • 39. 4. Do you take advantage of reusable RAML constructions? Keeping it DRY matters ● includes: inline one files to another ● resource types: reuse structures of methods ● traits: reuse attributes (auth/search/sort/..)
  • 40. 5. Is your documentation interactive for end user? API Console: visualize structure, provide in-browser testing API Notebook: JS scripting workspace; versioned, forkable and shareable API use cases Speeds up the development
  • 41. 6. Does your whole team collaborate on API design? The usual issues in flow of team interaction It needs to be done async-way You should also be able to walk any direction
  • 42. 6. Does your whole team collaborate on API design? The role of API documentation here: providing clear and persistent feedback loop Mocking as an essential part Which is easy for you
  • 43. 7. Do you automate test & validation of requests and responses? Not enough to just have doc and schemas Perform validation automatically on test run Schemas as a linking element of the system
  • 44. 7. Do you automate test & validation of requests and responses? Data for test requests (and examples): ● writing manually (fixtures) ● generating it automatically (factories) What’s wrong with fixtures ..and with factories
  • 45. 8. Do you have your documentation up to date and easily accessible to the team? Private and public APIs Builded (into html), served (via http) ..on demand locally, automatically on CI.. Automate to the max (+ autoreload, autoopen)
  • 46. 9. Does your API itself follows best practices? ● stable ● flexible ● secure ● <..> ● properly versionated ● throttled ● fast
  • 47. Takeaways Lots of daily pain removed Good for new devs joining: dive fast, water is clear Manually write JSON requests/responses less, generate it more Attention to maintentence. The whole thing gets outdated Use the tools and automate everything to be productive