SOA proliferation through speci fi cation James Earl Douglas - - PowerPoint PPT Presentation

soa proliferation through speci fi cation
SMART_READER_LITE
LIVE PREVIEW

SOA proliferation through speci fi cation James Earl Douglas - - PowerPoint PPT Presentation

SOA proliferation through speci fi cation James Earl Douglas MediaWiki Developer Summit 2015 Thesis Service development and consumption fl ourishes in a well-speci fi ed ecosystem. Agenda Background Examples Roadmap Background


slide-1
SLIDE 1

SOA proliferation through specification

James Earl Douglas MediaWiki Developer Summit 2015

slide-2
SLIDE 2

Thesis

Service development and consumption flourishes in a well-specified ecosystem.

slide-3
SLIDE 3

Agenda

Background Examples Roadmap

slide-4
SLIDE 4

Background

Service-oriented architecture Specification Specification formats Swagger

slide-5
SLIDE 5

Service-oriented architecture

Feature stew See also: the join calculus Composable units of functionality foo bar baz = foo ∘ bar

slide-6
SLIDE 6

Specification

Establish boundaries Limit the set of features Limit the scope of each feature Describe the interface "To foo a bar, you must provide a baz, and you will receive a qux."

slide-7
SLIDE 7

Specification formats

IETF RFC MW RFC WSDL WADL RAML API Blueprint Swagger

slide-8
SLIDE 8

Swagger

{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "RESTBase", "description": "Distributed storage with REST API & dispatcher for backend service", "termsOfService": "https://github.com/wikimedia/restbase#restbase", "contact": { "name": "Services", "email": "services@lists.wikimedia.org",

http://wikimedia.github.io/restbase/v1/swagger.json

slide-9
SLIDE 9

Examples

Swagger UI Swagger static documentation Swagger client generation T est automation

slide-10
SLIDE 10

Swagger UI

http://wikimedia.github.io/restbase/v1/swagger.json Explore

RESTBase UI

RESTBase is currently in alpha - expect changes until 1.0.0 is finalized This UI expects RESTBase to be running locally on your system, accessible via http://localhost:7231/v1/. Follow the installation instructions to get it up and running locally.

http://wikimedia.github.io/restbase/

slide-11
SLIDE 11

Swagger static documentation

RESTBase

Distributed storage with REST API & dispatcher for backend service for our Partner More information: https://www.mediawiki.org/wiki/Services Contact Info: services@lists.wikimedia.org GNU Affero http://opensource.org/licenses/AGPL-3.0

http://wikimedia.github.io/restbase/v1/

slide-12
SLIDE 12

Swagger client generation

var httpsync = require('httpsync'); var codegen = require('swagger-js-codegen').CodeGen; var fs = require('fs'); var specUrl = 'http://wikimedia.github.io/restbase/v1/swagger.json'; var response = httpsync.get(specUrl).end(); var swagger = JSON.parse(response.data.toString()); var clientJs = codegen.getNodeCode({ className: 'RESTBase', swagger: swagger }); fs.writeFileSync('client.js', clientJs);

slide-13
SLIDE 13

Swagger-generated client

var RESTBase = (function() { RESTBase.prototype.listRevisions = function(parameters) { // ... RESTBase.prototype.getLatestFormat = function(parameters) { // ... RESTBase.prototype.getFormatRevision = function(parameters) { // ... RESTBase.prototype.getFormatRevision = function(parameters) { // ... // ... })(); exports.RESTBase = RESTBase;

slide-14
SLIDE 14

Test automation

Swagger is extensible Augment spec with request/response pairs Use them generated documentation Use them in automated tests

"x-amples": [ { "request": { "params": { "domain": "en.wikipedia.test.local", "title": "Foobar" } }, "response": { "status": 200, "headers": { "content-type": "text/html;profile=mediawiki.org/specs/html/1.0.0" } }

slide-15
SLIDE 15

} ]

slide-16
SLIDE 16

Roadmap

Where we're going How we'll get there

slide-17
SLIDE 17

Where we're going

Happy users Features delivered as desired. Excited developers Empowered to build and deliver awesomeness. Rainbows and ponies for all OMG!! Ponies!!

slide-18
SLIDE 18

How we'll get there

Q) How do we stay on track? A) Specify it. Spec has to be reliable v1 can change within in the philosophy of SemVer v2 can change anything it wants Spec-first vs. spec-last Hitting the ground running vs. blocking by backend Deliberate vs. accidental

slide-19
SLIDE 19
slide-20
SLIDE 20

References

Semantic Versioning Design by contract Swagger swagger-js-codegen You are what you document

slide-21
SLIDE 21

Discussion

How do you document your APIs? How do you enforce your specifications? Does your documentation catch up to your code? Does your code catch up to your documentation? What are your favorite Web services? What are your favorite APIs?