Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Writer APIs in Java faster with Swagger Inflector

2,241 views

Published on

Swagger provides a clean contract for your REST API. Swagger Inflector is a project which uses Swagger as the language of the API, automatically wiring REST endpoints directly to controllers in the Jersey 2.x framework. By doing so, the specification and code are always up to date, removing potentially error-prone redundant code and bringing development on the JDK up to speed with typeless languages.

Published in: Technology

Writer APIs in Java faster with Swagger Inflector

  1. 1. Iterative Development with Swagger on the JDK Tony Tam @fehguy
  2. 2. 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
  3. 3. Workflow-Specific Configuration • Customized class + templates Server Docker Image ObjC Client Java Client Re-generation with Changes APM integration with Newrelic Ops integration with DataDog Configured name, versions Push to docker repo via Jenkins build Podfile Push to github repo on Jenkins Build Artifact Push to Maven Repo on Jenkins Build
  4. 4. Workflow-Specific Configuration • Independent Iterations from single definition Design + Collaborate Generate Implement Client Implement Logic Iterate Iterate Deploy Deploy
  5. 5. 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…
  6. 6. So What’s Broken?
  7. 7. 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
  8. 8. Swagger-Inflector • A new Friction Reducer • Programmatic endpoint generation • Your new Plumber
  9. 9. 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
  10. 10. Inflector Workflow Design + Collaborate Generate Implement Client Implement Logic Iterate Iterate Deploy Deploy
  11. 11. Focus on Business Logic! inflector.yaml swagger.yaml
  12. 12. Iterative Development! • Unimplemented methods return mock data
  13. 13. Complex Schemas
  14. 14. Shut up already! • DEMO
  15. 15. Stop Plumbing! Remove Redundant Logic
  16. 16. State of the Project • Preview available! – https://github.com/swagger-api/swagger- inflector • Plenty to do! • Will become a fully supported part of Swagger • More Samples soon
  17. 17. • Questions?

×