Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OpenAPI 3.1 and Spring-Boot 3 What's New?

Badr
May 31, 2024

OpenAPI 3.1 and Spring-Boot 3 What's New?

APIs play a central role in the evolution of business IT. Adopting an industrial approach is crucial. In this discussion, we will extensively explore springdoc-openapi.

With over 25 million monthly downloads, springdoc-openapi is a significant player in the OpenAPI landscape for spring applications. We will delve into how this project can expedite the adoption of APIs.

During this talk, we will deep dive into springdoc-openapi main functionalities:

Introduction to OpenAPI 3
What is the purpose of springdoc-openapi?
Integration with spring-web and spring-webflux
GraalVM native images support
Integration with Kotlin
Integration with actuator
Reuse Javadoc in REST APIs descritpion
Integration with spring HATEOAS and spring Data REST
Integration with spring-security and OAuth 2.0 - Example with spring–authorization-server
Multiple OpenAPI groups support
Integration with spring-cloud-function-web
Integration with spring-cloud-gateway in a microservices architecture
Integration with Kotlin / Groovy
Generation of the OpenAPI 3 documentation with gradle/maven

Badr

May 31, 2024
Tweet

More Decks by Badr

Other Decks in Programming

Transcript

  1. AGENDA •OpenAPI Introduction •What is new OpenAPI 3.1 and spring-boot

    3 ? •springdoc-openapi features •Demo and Q&A
  2. • Documenting your API is critical for your business and

    partners. • You want your API to be easy for app developers to understand in order to drive API consumption. • Since 2010, there are a lot of industries adopting OpenAPI specification to discover and understand the capabilities of a REST API without the need to have access to source code. • The OpenAPI spec, helps you achieve informative, consistent but also interactive documentation. 4
  3. 5 • Understanding and Integration • Onboarding and Learning •

    Preventing / Reducing Errors • Interoperability • Updates and Changes • Troubleshooting • Efficient Development • Promoting Adoption • Compliance and Standards API Lifecycle
  4. • Written in either JSON or YAML • OpenAPI specification

    uses a standard format to describe a RESTful API. • The goal is keep the spec machine-readable, • But also make it easy for humans to understand as well. • All specifications include descriptions for the following elements: 6
  5. 8

  6. 9

  7. 10

  8. • JDK 17/21 (records, sealed classes, virtual threads … )

    • Jakarta EE 9 / 10 (Jakarta namespace) - Removal of Javax support • Servlet API 5.0 / 6.0 • Hibernate ORM 6.1 – JPA 3.0 / 3.1 • Hibernate Validator 7.0 / 8.0 – Bean Validation 3.0 • RFC 7807 Problem Details • Observability (Micrometer) • AOT (Ahead-Of-Time) Compilation • GraalVM Native images support • But wait, there's more! – Docker Compose Module – Virtual Threads (“Project Loom”) – Class Data Sharing (CDS) 11 Spring Boot 3 Consider upgrading your JDK along with Spring Framework 6.x Production-ready on Java 21 LTS
  9. üProject Open Source since 2019 ü27 millions downloads on April

    2024 ü3 100 stars in github 12 Numbers using Maven Central - Sonatype üCompanies or projects officially using springdoc-openapi 0 5 000 000 10 000 000 15 000 000 20 000 000 25 000 000 30 000 000 May-23 Jun-23 Jul-23 Aug-23 Sep-23 Oct-23 Nov-23 Dec-23 Jan-24 Feb-24 Mar-24 Apr-24 Downloads over the last 12 months for springdoc-openapi
  10. 14 Spring Boot Swagger Springdoc-openapi Spring-webmvc Spring-webflux springdoc-openapi-starter-webmvc-api springdoc-openapi-starter-webflux-api springdoc-openapi-starter-common

    swagger-core-jakarta spring-boot-autoconfigure springdoc-openapi-starter-webmvc-ui springdoc-openapi-starter-webflux-ui Swagger-ui UI REST API For Servlet projects For Reactive projects
  11. • All the modules have been renamed. • springdoc-openapi- starter-

    common integrates many spring modules support in order to hide the maximum of complexity. • It allows the support out of the box for Actuator / Spring Cloud Function / Spring Data Rest/ Spring Native/ Spring Hateoas / Spring Securtiy / Kotlin/ Javadoc . 16
  12. • Languages supported: Java, Kotlin and Groovy • Integration of

    JSR 303 Bean Validation with OpenAPI 3 • Integration with actuator for the observability • Problem Details for HTTP APIs specification, RFC 7807 • Global Exception Handling Using Controller Advice • Integration with spring-security • Spring Authorization Server 1.0 (OAuth 2.1 and OpenID Connect 1.0) • Multiple API groups per same application • Support for spring-cloud-gateway • Support of OpenAPI generation, from Javadoc documentation • CI/CD integration with offline generation, during integration tests • Highly customizable: More than 100 configuration properties • And when feature not possible, abitliy to extend and customize (OpenApiCustomiser, OperationCustomizer, ParameterCustomizer, PropertyCustomizer) 17 Problem Details example with RFC 7807
  13. 19