OpenAPI Extensibility - The Good, The Bad and The YAMLy

A presentation at API:World 2024 in November 2024 in Santa Clara, CA, USA by Baruch Sadogursky

Slide 1

Slide 1

OpenAPI Extensibility The Good, The Bad, The YAMLy Oleg Nenashev, Baruch Sadogursky, Laura Kassovic #DPE #ApiWorld https://speaking.jbaru.ch

Slide 2

Slide 2

#DPE #ApiWorld https://speaking.jbaru.ch

Slide 3

Slide 3

Baruch Sadogursky Developer Productivity Advocate DevRel Advisor @Gradle Java Champion CNCF Ambassador Alumni @jbaruch jbaruch #DPE #ApiWorld https://speaking.jbaru.ch

Slide 4

Slide 4

Laura Kassovic Technical Writer Community Builder Open Source Advocate lkasso #DPE #ApiWorld https://speaking.jbaru.ch

Slide 5

Slide 5

Oleg Nenashev - Online Edition Dr. Nenashev / Mr. Jenkins Community builder Developer Tools Hacker @oleg_nenashev oleg-nenashev #DPE #RussiansAgainstPutin #StandWithUkraine #ApiWorld https://speaking.jbaru.ch

Slide 6

Slide 6

Shownotes ● speaking.jbaru.ch ● Slides ● All the links! ● Video #DPE #ApiWorld https://speaking.jbaru.ch 6

Slide 7

Slide 7

Developer Productivity Engineering (DPE) 7 #DPE #ApiWorld https://speaking.jbaru.ch

Slide 8

Slide 8

Developer Productivity Engineering (DPE) gradle.com/ developer-productivity-engineering #DPE #ApiWorld https://speaking.jbaru.ch

Slide 9

Slide 9

9 #DPE #ApiWorld https://speaking.jbaru.ch x.com/dastbe/status/1303858170155081728

Slide 10

Slide 10

The UNIX way ● Write programs that DO ONE THING and DO IT WELL ● Write programs to WORK TOGETHER ● Write programs to handle text streams, because that is a UNIVERSAL INTERFACE Peter H. Salus, A Quarter-Century of Unix (1994) #DPE #ApiWorld https://speaking.jbaru.ch 10

Slide 11

Slide 11

Interoperability and Interfaces are the Key #DPE #ApiWorld https://speaking.jbaru.ch 11

Slide 12

Slide 12

Most Apps and Dev Tools Work with APIs Client App #DPE request request response response HTTP/2 API API Server #ApiWorld Storage https://speaking.jbaru.ch 12

Slide 13

Slide 13

API specs #DPE API tech #ApiWorld https://speaking.jbaru.ch

Slide 14

Slide 14

#DPE #ApiWorld https://speaking.jbaru.ch 14

Slide 15

Slide 15

#DPE #ApiWorld https://speaking.jbaru.ch

Slide 16

Slide 16

#DPE #ApiWorld https://speaking.jbaru.ch

Slide 17

Slide 17

OpenAPI 101 Request-Response definitions Parameters Response samples Extensions #DPE #ApiWorld https://speaking.jbaru.ch 17

Slide 18

Slide 18

Huge Tools Ecosystem #DPE #ApiWorld https://tools.openapis.org https://speaking.jbaru.ch 18

Slide 19

Slide 19

Example: OpenAPI plugins for Gradle 100+ related Gradle plugins Libraries and integrations in any [modern] framework (!) OpenAPI Generator #DPE #ApiWorld https://speaking.jbaru.ch 19

Slide 20

Slide 20

Who uses OpenAPI? EVERYOOOONE!!! #DPE #ApiWorld https://speaking.jbaru.ch

Slide 21

Slide 21

The industry uses OpenAPI, too #DPE #ApiWorld https://speaking.jbaru.ch 2021 Data. Source: inform.tmforum.org/features-and-opinion/the-status-of-open-api-adoption 21

Slide 22

Slide 22

We leverage OpenAPI in Develocity, too #DPE #ApiWorld https://speaking.jbaru.ch 22

Slide 23

Slide 23

Example: Develocity ● Not just OpenAPI, but an API Manual ○ https://docs.gradle.com/develocity/api-manual ● Versioning and Depreciation policy via OpenAPI annotations ● User-friendly changelogs #DPE #ApiWorld https://speaking.jbaru.ch 23

Slide 24

Slide 24

Application Programming Interface Example: OpenAPI Generator ● Automates the creation of ○ ○ ○ ○ Input: Output: client libraries, server stubs, API documentation, and configuration files ● from an OpenAPI Spec https://openapi-generator.tech/ #DPE #ApiWorld https://speaking.jbaru.ch 24

Slide 25

Slide 25

We support OpenAPI Generator ● ○ Build Scan and Troubleshooting ○ Local and Distributed build caching ○ Predictive Test Selection ○ CI/CD observability and Insights ○ Local build observability #DPE #ApiWorld Public Develocity Instance: ge.openapi-generator.tech https://speaking.jbaru.ch 25

Slide 26

Slide 26

● We support open source ● Many projects run with Develocity ● Maven, Bazel, sbt.., and Gradle gradle/develocity-oss-projects #DPE #ApiWorld https://speaking.jbaru.ch

Slide 27

Slide 27

Huge Tools Ecosystem (RECAP) #DPE #ApiWorld https://tools.openapis.org https://speaking.jbaru.ch 27

Slide 28

Slide 28

Interoperability && Extensibility #DPE at scale… #ApiWorld https://speaking.jbaru.ch 28

Slide 29

Slide 29

OpenAPI 101 Request-Response definitions Parameters Response samples Extensions #DPE #ApiWorld https://speaking.jbaru.ch 29

Slide 30

Slide 30

OpenAPI Extensions 101 https://github.com/OAI/OpenAPI-Specification/blob /main/guidelines/v2.0/EXTENSIONS.md #DPE #ApiWorld https://speaking.jbaru.ch 30

Slide 31

Slide 31

OpenAPI Extensions github.com/OAI/OpenAPI-Specification/blob/main/guidelines/v2.0/EXTENSIONS.md #DPE spec.openapis.org/oas/latest.html#specification-extensions #ApiWorld https://speaking.jbaru.ch 31

Slide 32

Slide 32

Example: Develocity API docs.gradle.com/develocity/api-manual/ #reference_documentation openapi: 3.0.3 info: title: Develocity API description: > Allows programmatic interaction with Develocity, from config to build data version: “2024.2” license: name: Develocity License url: https://gradle.com/legal-gradle-software-license-agreement termsOfService: https://gradle.com/help/legal-terms-of-use x-logo: url: https://assets.gradle.com/logo/develocity-logo.svg altText: Develocity #DPE #ApiWorld https://speaking.jbaru.ch 32

Slide 33

Slide 33

Example: Develocity API … docs.gradle.com/develocity/api-manual/ #reference_documentation tags: - name: BuildCache x-displayName: Build Cache description: | Endpoints related to configuring the Build Cache nodes of the Develocity instance. To access these endpoints the user requires the Configure build caches permission. - name: Projects x-displayName: Projects (Beta) description: | Endpoints related to the management of projects in Develocity. To access these endpoints the user requires the Administer Projects permission. #DPE #ApiWorld https://speaking.jbaru.ch 33

Slide 34

Slide 34

#DPE #ApiWorld https://speaking.jbaru.ch 34

Slide 35

Slide 35

#DPE #ApiWorld https://speaking.jbaru.ch

Slide 36

Slide 36

Example: AWS API Gateway #DPE https://swagger.io/docs/specification/v3_0/openapi-extensions #ApiWorld https://speaking.jbaru.ch 36

Slide 37

Slide 37

YAML DevX #DPE #ApiWorld https://speaking.jbaru.ch 37

Slide 38

Slide 38

OpenAPI is not DRY #DPE #ApiWorld https://speaking.jbaru.ch

Slide 39

Slide 39

And more constructive! 39 #DPE #ApiWorld https://speaking.jbaru.ch

Slide 40

Slide 40

#DPE #ApiWorld https://speaking.jbaru.ch

Slide 41

Slide 41

#DPE #ApiWorld https://speaking.jbaru.ch

Slide 42

Slide 42

Wait, it’s all just Swagger? OpenAPI 3 Extensions #DPE #ApiWorld https://speaking.jbaru.ch 42

Slide 43

Slide 43

So, but what’s ugly? ● Limited v3 Documentation, mostly inherited from Swagger ● Little updates and docs before late 2023 ● Little “extension specs” #DPE #ApiWorld https://speaking.jbaru.ch 43

Slide 44

Slide 44

Specification is an inspiration ● Nobody cares where “x-” fields are supported or not ● Almost everything in “x-” fields? Why not ● Encrypted data in spec? Data blobs? Why not? ● Contribute back? Why? #DPE #ApiWorld Image source: dev.to/meatboy/what-are-modern-examples-of-embrace-extend-and-extinguish-21j3 https://speaking.jbaru.ch 44

Slide 45

Slide 45

#DPE Source: https://medium.com/10-minutes-qa-story/api-testing-from-scratch-api-anatomy-f220856ce9b3 #ApiWorld https://speaking.jbaru.ch 45

Slide 46

Slide 46

Extensions are for lock-in ● Most specs are generated by tools, they leverage extensions ● JSON/YAML extensions are not great to manage ● OpenAPI specifications are huge and not sustainable as is ● OpenAPI but with SDKs #DPE #ApiWorld https://speaking.jbaru.ch 46

Slide 47

Slide 47

Where did we see “x-”tensions? ● Authorization model ● Parameter values for samples ● Feature flags ● Conditions ● Stateful behavior ● … #DPE #ApiWorld Image source: orchid-tech.com/design-notes/ fpga-complex-algorithm-development/ https://speaking.jbaru.ch 47

Slide 48

Slide 48

#DPE #ApiWorld https://speaking.jbaru.ch

Slide 49

Slide 49

#DPE #ApiWorld https://speaking.jbaru.ch

Slide 50

Slide 50

OpenAPI 4 github.com/OAI/moonwalk #DPE #ApiWorld https://speaking.jbaru.ch 50

Slide 51

Slide 51

OpenAPI 4 “Moonwalk” Project Evolve the OpenAPI Specification to: 1. Address limitations in the existing OpenAPI 3.x versions 2. Introduce features that allow for more expressive API definitions, including support for advanced use cases 3. Improve user experience 4. Encourage contributions and community feedback #DPE #ApiWorld https://github.com/OAI/moonwalk https://speaking.jbaru.ch 51

Slide 52

Slide 52

OpenAPI 4 “Moonwalk” Features ● Support APIs that have different responses based on query parameters, headers and request bodies. ● Broader range of URL design patterns ● Reduce nested structures to improve readability and editability ● Improve reusability of request and response patterns #DPE #ApiWorld https://github.com/OAI/moonwalk https://speaking.jbaru.ch 52

Slide 53

Slide 53

OpenAPI 4 “Moonwalk” Wishlist: Extensions Registry ● OpenAPI 4 should include standard spec extensions ● From x-logo to x-auth #DPE #ApiWorld https://speaking.jbaru.ch 53

Slide 54

Slide 54

OpenAPI 4 “Moonwalk” Wishlist: Overlay Specifications to become a part of the standard aka “openapi-patch” injecting duplicated content into the specs spec.openapis.org/ove rlay/v1.0.0.html Source: https://www.youtube.com/watch?app=desktop&v=Iiygq3r1QPs #DPE #ApiWorld https://speaking.jbaru.ch 54

Slide 55

Slide 55

PLEASE MAKE IT HAPPEN #DPE #ApiWorld https://speaking.jbaru.ch Source: https://www.businesstoday.in/visualstories/news/will-boeings-starliner-failures-impact-nasas-artemis-3-moon-landing-similar-to-sunita-williams-space-stranding-161968-12-08-2024 55

Slide 56

Slide 56

If you develop OpenAPI Specs ● Need more? OpenAPI Extensions are an engine to consider ● Extensions help where the specification does not ● Try out Moonwalk, share feedback #DPE #ApiWorld https://speaking.jbaru.ch 56

Slide 57

Slide 57

If you consume OpenAPI Specs ● Productize API - documentation, tools, versioning and maintenance ● Keep your OpenAPI version up to date ● Document / Share your extensions #DPE #ApiWorld https://speaking.jbaru.ch 57

Slide 58

Slide 58

OPENQuestions? OpenAPI Initiative Slack Gradle Slack, #developer-productivity #DPE #ApiWorld https://speaking.jbaru.ch 58