This example Spring Boot app demonstrates recommended practices for generating clear OpenAPI specifications and SDKs.
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.
To install the application on your local machine:
- Clone the repository:
git clone https://github.com/speakeasy-api/spring-boot-openapi-example.git
- Navigate into the directory:
cd spring-boot-openapi-example
- Install all dependencies using Maven:
./mvnw clean install
brew install speakeasy-api/homebrew-tap/speakeasy
Start the server:
./mvnw spring-boot:run
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.
This project is licensed under the terms of the Apache 2.0 license.