openapi spec at google (open api initiative meetup on 2016-09-15)

26
Dan Ciruli (@danciruli) Product Manager OpenAPI @ Google What we’re doing with the baddest spec around

Upload: open-api-initiative-oai

Post on 21-Mar-2017

788 views

Category:

Data & Analytics


3 download

TRANSCRIPT

Page 1: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Dan Ciruli (@danciruli)Product Manager

OpenAPI @ GoogleWhat we’re doing with the baddest spec around

Page 2: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

01 API Descriptions at GoogleWhere have we been?

Page 3: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

3

Our own format...

While Tony Tam was creating Swagger...

In 2010, Google APIs team launched infrastructure based on the Discovery Format -- a JSON format

Page 4: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 4

Why?

Necessity No standard

Page 5: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

5

Discovery Document

A substantial amount of infrastructure was written based on it:

Some visible● Client library generation (10 languages)● APIs Explorer● Discovery service● Documentation generation

Some not visible● Proxy (translates JSON over HTTP to proto

over stubby), capable of X million requests per second

Page 6: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 6

What went well...● Over 150 public APIs● Hundreds of thousands of developers● Many billions of API calls...every day.

What didn’t go so well...● Didn’t work with the open source community

Post Mortem

Page 7: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

7

Our own format (cont’d)...

In 2015, in response to a need for lower latency, more efficient data, and HTTP/2 features like bi-directional streaming, we introduced gRPC.

But...all done in open source this time!

Page 8: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

02 Why did Google join OAI?History and Status

Page 9: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 9

Open = better

Page 10: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

10

Toolchains & APIs matter

Photo credit: Modnar

Page 11: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

03 OAS at GoogleWhat’s happening now and where are we going?

Page 12: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

12

Kubernetes

Kubernetes is an open source container management system, initially released in 2014.

Kubernetes.io publishes all APIs in Swagger (currently 1.2, will upgrade to publish v2.0 as of kubernetes 1.5).

Kubernetes server publishes Swagger specs and ships with Swagger UI

Page 13: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 13

gRPC APIs are serving Open API specs

One of the features of our new API infrastructure is serving multiple description formats...including OpenAPI specs.

https://cloudfunctions.googleapis.com/$discovery/swagger2?version=v1

Page 14: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 14

Google API Compiler

Open source compiler that takes OAS files (or .proto + YAML) and generates Google API Service Configurations

Service Config is used by various downstream systems (client library generation, documentation gen, etc).

Open sourced here, more tools to come.

Page 15: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 15

Cloud Endpoints

● API Management● Server-local proxy● All configuration happens through

Open API spec

Page 16: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 16

Dashboards and UI

Configuration (access, auth, etc) enforced at runtime

Documentation generation and API Explorer delivered via two toolchains (see next slide)

NGINX-based proxy built-in to App Engine,a available in a

container in a GKE pod or GCE.

Cloud Endpoints

Page 17: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 17

Why server-local proxy?

Extremely thinEliminates network hop

Scales with your app

<1 ms latency

Page 18: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 18

JSON-HTTP/1.1

Use Open API specs to manage RESTful APIs written in any language and with

any framework.

proto-HTTP/2

Use gRPC to build highly efficient

HTTP/2-based APIs

Cloud Endpoints: Choose your protocol

Page 19: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 19

$ lspackage.json high-score.js high-score-open-api.yaml app.yaml

$ gcloud app deployRecognized a [node] applicationRecognized an [OpenAPI] API spec Building app image… doneDeploying app image to[http://high-score.stannrapis.com]… doneNow serving API at[http://high-score.stannrapis.com]… doneManage the API at[console.developers.google.com]

$ curl high-score.stannrapis.com/v1/scores/0{ “highscores”: [

{“score”:125239, “player”:“dwc”},{“score”:124231, “player”:“jta”}

]}

1. System detects an Open API spec (yaml) with app

2. Does normal App Engine Flex app package & deploy

3. Spins up additional proxy container with GAE container, applies control plane

4. API is served, listed in Cloud Console user interface

Page 20: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

04 What’s next?What’s happening now and where are we going?

Page 21: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 21

Page 22: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 22

API

Page 23: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 23

APIs are...big at Google

Open Source● Both Apigee and Google were

founding members of the Open API Initiative

● We will undoubtedly continue to work both with the spec and with various open source projects related to it

● Google Cloud is committed to being the open cloud -- contributing to existing products, open sourcing internal technologies, creating new projects

Page 24: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Google Cloud Platform 24

How do you represent a more RPC-style API in the spec? How about proto? Could there be a canonical representation of a gRPC API in Open API?

Can our experience with code gen be useful?

Can we represent the richness of the Discovery Document in Open API?

Issues important to us

Page 25: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Thanks!

@danciruli@googleapis

Page 26: OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)

Build what’s next.

Confidential & ProprietaryGoogle Cloud Platform 26