Top Banner
Iterative Development with Swagger on the JDK Tony Tam @fehguy
15
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Iterative Development with Swagger on the JDK

Iterative Developmentwith Swagger on the JDK

Tony Tam

@fehguy

Page 2: Iterative Development with Swagger on the JDK

Swagger Codegen

• Creation of Clients, Servers from Swagger Spec– 5 servers

• Java, Scala, PHP, node.js

– 19 clients• Android, Scala, C#, Java, Objective-C, Perl, PHP,

Python, QT-CPP, Retrofit, Ruby, HTML, Swift, Tizen, Typescript Angular

– Nearly unlimited workflow integration possibilities

Page 3: Iterative Development with Swagger on the JDK

Workflow-Specific Configuration

• Customized class + templates

Server

Docker Image

ObjC Client

Java Client

Re-generation with ChangesAPM integration with NewrelicOps integration with DataDog

Configured name, versionsPush to docker repo via Jenkins build

PodfilePush to github repo on Jenkins Build

ArtifactPush to Maven Repo on Jenkins Build

Page 4: Iterative Development with Swagger on the JDK

Workflow-Specific Configuration

• Independent Iterations from single definition

Design+

CollaborateGenerate

ImplementClient

ImplementLogic

Iterate

Iterate

Deploy

Deploy

Page 5: Iterative Development with Swagger on the JDK

So What’s Broken?

• Nothing really! But…– Source Code collisions can be avoided– What’s the source of truth?– How do non-engineers improve

documentation?

• Not to nitpick but…

Page 6: Iterative Development with Swagger on the JDK

So What’s Broken?

Page 7: Iterative Development with Swagger on the JDK

Specification-Driven Development

• The Swagger Specification should be the source of truth– No round-trips to/from codegen– No out-of-date server based on code changes

Page 8: Iterative Development with Swagger on the JDK

Swagger-Inflector

• A new Friction Reducer• Programmatic endpoint generation• Your new Plumber

Page 9: Iterative Development with Swagger on the JDK

How it Works

• Write your Specification• Inflector wires your spec to the server• Endpoints have automatic sample data• Implementation is simply writing

controllers• Based on JAX-RS 2.0, Jersey 2.6

Page 10: Iterative Development with Swagger on the JDK

Inflector Workflow

Design+

Collaborate

Generate ImplementClient

ImplementLogic

Iterate

Iterate

Deploy

Deploy

Page 11: Iterative Development with Swagger on the JDK

Focus on Business Logic!inflector.yaml

swagger.yaml

Page 12: Iterative Development with Swagger on the JDK

Iterative Development!

• Unimplemented methods return mock data

application/xml

application/json

Page 13: Iterative Development with Swagger on the JDK

Complex Schemas

Page 14: Iterative Development with Swagger on the JDK

Stop Plumbing!

Remove Redundant

Logic

Page 15: Iterative Development with Swagger on the JDK

State of the Project

• Preview available!– https://github.com/swagger-api/swagger-inflec

tor

• Plenty to do!• Will become a fully supported part of

Swagger• More Samples soon