Skip to content

ritza-co/spring-boot-openapi-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This example Spring Boot app demonstrates recommended practices for generating clear OpenAPI specifications and SDKs.

Prerequisites

You need to have Java and Maven installed on your system to run this project. If you don't have these installed, you can download them from here and here.

To generate an SDK, you'll also need the Speakeasy CLI installed, or use the Speakeasy dashboard.

Installation

To install the application on your local machine:

  1. Clone the repository:
git clone https://github.com/speakeasy-api/spring-boot-openapi-example.git
  1. Navigate into the directory:
cd spring-boot-openapi-example
  1. Install all dependencies using Maven:
./mvnw clean install
  1. Install Speakeasy CLI:
brew install speakeasy-api/homebrew-tap/speakeasy

Running the application

Start the server:

./mvnw spring-boot:run

Working with the OpenAPI specification

Spring Boot automatically generates an OpenAPI specification. You can view it at:

  • /swagger-ui.html - Swagger UI
  • /api-docs - Raw OpenAPI JSON
  • /api-docs.yaml - Raw OpenAPI YAML

To save the OpenAPI specification to a file:

curl http://localhost:8080/api-docs.yaml > openapi.yaml

To generate an SDK, run:

speakeasy generate sdk \
  --schema openapi.yaml \
  --lang typescript \
  --out ./sdk

You can replace typescript with any supported language of your choice.

License

This project is licensed under the terms of the Apache 2.0 license.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages