Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
OpenAPI and Java - Portland - 2019-12-10
Search
sullis
December 10, 2019
Programming
0
240
OpenAPI and Java - Portland - 2019-12-10
Portland Java User Group
Portland Oregon
December 10, 2019
#openapi
#java
sullis
December 10, 2019
Tweet
Share
More Decks by sullis
See All by sullis
Dependency management for Java applications 2025-09-11
sullis
0
8
S3 NYC Iceberg meetup 2025-07-10
sullis
0
41
Amazon S3 Chicago 2025-06-04
sullis
0
100
Amazon S3 Boston 2025-05-07
sullis
0
55
Netty ConFoo Montreal 2025-02-27
sullis
0
100
GitHub Actions ConFoo Montreal 2025-02-26
sullis
0
63
Netty Portland Java User Group 2025-02-18
sullis
0
12
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
190
Amazon S3 - Portland Java User Group 2024-09-17
sullis
0
110
Other Decks in Programming
See All in Programming
Processing Gem ベースの、2D レトロゲームエンジンの開発
tokujiros
2
130
1から理解するWeb Push
dora1998
7
1.9k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
400
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
230
私の後悔をAWS DMSで解決した話
hiramax
4
210
The Past, Present, and Future of Enterprise Java with ASF in the Middle
ivargrimstad
0
160
Improving my own Ruby thereafter
sisshiki1969
1
160
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
230
AIを活用し、今後に備えるための技術知識 / Basic Knowledge to Utilize AI
kishida
22
5.8k
為你自己學 Python - 冷知識篇
eddie
1
350
ユーザーも開発者も悩ませない TV アプリ開発 ~Compose の内部実装から学ぶフォーカス制御~
taked137
0
190
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
1.9k
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
339
57k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Rails Girls Zürich Keynote
gr2m
95
14k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
113
20k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
How to Think Like a Performance Engineer
csswizardry
26
1.9k
Producing Creativity
orderedlist
PRO
347
40k
Designing Experiences People Love
moore
142
24k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
13k
Large-scale JavaScript Application Architecture
addyosmani
513
110k
Transcript
OpenAPI and Java Sean Sullivan Portland Java User Group December
10, 2019
About me software engineer Portland Oregon Java Scala
Agenda OpenAPI Real world examples Java tools and libraries API
guidelines
OpenAPI
OpenAPI is a specification for describing API’s
API specifications
WSDL (SOAP) WADL (REST)
Swagger (REST) OpenAPI (REST)
https://en.wikipedia.org/wiki/OpenAPI_Specification
REST API’s
API Driven Development
“API first”
source: Adobe Tech Blog June 2017
Code first vs API schema first
JSON or YAML
Real world examples
Case Study: stripe.com OpenAPI
https://github.com/stripe/openapi
https://github.com/stripe/openapi
Case Study: squareup.com OpenAPI
https://github.com/square/connect-api-specification
Case Study: Kubernetes OpenAPI
https://github.com/kubernetes/kubernetes/tree/master/api/openapi-spec
https://github.com/kubernetes-client/java Kubernetes Java Client
https://github.com/kubernetes-client/java Kubernetes Java Client code generation
Case Study: Microsoft Azure OpenAPI
https://github.com/Azure/azure-rest-api-specs azure-rest-api-specs
Case Study: Amazon EventBridge OpenAPI
https://docs.aws.amazon.com/eventbridge Amazon EventBridge “EventBridge is a serverless event bus service
that makes it easy to connect your applications with data from a variety of sources”
https://docs.aws.amazon.com/eventbridge EventBridge Schema Registry Schemas are defined using JSON files,
using the OpenAPI specification
https://www.tbray.org/ongoing/When/201x/2019/12/02/Strongly-Typed-Events Strongly typed events
Java tools and libraries
Swagger libraries swagger-core swagger-parser swagger-codegen swagger-inflector
https://github.com/swagger-api/swagger-parser Swagger parser
pom.xml <dependency> <groupId>io.swagger.parser.v3</groupId> <artifactId>swagger-parser</artifactId> <version>2.0.16</version> </dependency> Swagger parser
https://github.com/swagger-api/swagger-parser import io.swagger.v3.parser.OpenAPIV3Parser; import io.swagger.v3.oas.models.OpenAPI; String url = “http://petstore.swagger.io/v3/openapi.json”; OpenAPI
openAPI = new OpenAPIV3Parser().read(url); Swagger parser
https://github.com/swagger-api/swagger-parser Swagger parser Pull Request #1271
ObjectMapperFactory.java return new JsonFactoryBuilder() .enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION) .build(); Swagger parser Pull Request
#1271
Code generators Guardrail openapi-generator swagger-codegen AutoRest
Guardrail project
https://guardrail.dev/ Guardrail
https://github.com/twilio/guardrail Guardrail
https://github.com/twilio/guardrail Guardrail: Scala ScalaMeta
https://github.com/twilio/guardrail Guardrail: Java JavaParser
Guardrail example
guardrail-maven-plugin <plugin> <groupId>com.twilio</groupId> <artifactId>guardrail-maven-plugin_2.12</artifactId> <version>0.54.5</version> <executions> … </executions> </plugin>
guardrail-maven-plugin <configuration> <language>java</language> <kind>client</kind> <framework>dropwizard</framework> <specPath>${project.basedir}/src/main/openapi/petstore.json</specPath> <packageName>com.example.clients.petstore</packageName> </configuration> Java client
guardrail-maven-plugin
openapi-generator project
openapi-generator
openapi-generator
openapi-generator
REST API guidelines
https://github.com/microsoft/api-guidelines
https://www.infoq.com/news/2016/07/microsoft-rest-api/ July 2016
https://cloud.google.com/apis/design/
https://github.com/zalando/restful-api-guidelines
https://github.com/paypal/api-standards/blob/master/api-style-guide.md
Final thoughts use OpenAPI to define REST API’s adopt “API
First” approach use a code generator to generate client libraries contribute to open source projects
The End