https://github.com/td99/spring-boot-openapi-generator
Spring Boot 3 project demonstrating OpenAPI Generator with delegate pattern
https://github.com/td99/spring-boot-openapi-generator
demo java jpa openapi-generator rest-api spring-boot-3 swagger-ui
Last synced: 10 months ago
JSON representation
Spring Boot 3 project demonstrating OpenAPI Generator with delegate pattern
- Host: GitHub
- URL: https://github.com/td99/spring-boot-openapi-generator
- Owner: TD99
- License: mit
- Created: 2025-09-06T19:49:37.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-09-07T13:22:26.000Z (10 months ago)
- Last Synced: 2025-09-07T15:19:49.660Z (10 months ago)
- Topics: demo, java, jpa, openapi-generator, rest-api, spring-boot-3, swagger-ui
- Language: Java
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenAPI Generator Example
This project demonstrates how to use **OpenAPI Generator** with **Spring Boot 3**, **JPA**, and **Springdoc OpenAPI** to
build a simple REST API for managing TODOs. It uses the delegate pattern to separate generated code from custom business
logic.
## Features
- OpenAPI 3.0 specification-driven development
- Automatic Spring Boot controller & DTO generation
- Delegate pattern for business logic separation
- JPA & H2 in-memory database integration
- Spring Validation support
- Swagger UI for API exploration
## Getting Started
### Prerequisites
- Java 21+
- Maven 3.9+
### Build & Run
```bash
# Generate code from OpenAPI spec
mvn clean compile
# Run the application
mvn spring-boot:run
```
### API Endpoints
- `GET /todos` → List all todos
- `POST /todos` → Create a new todo
- `GET /todos/{id}` → Get a todo by ID
- `PUT /todos/{id}` → Update a todo
- `PATCH /todos/{id}` → Patch a todo
- `DELETE /todos/{id}` → Delete a todo
> You may also import the [openapi.yaml](src/main/resources/openapi.yaml) file into your OpenAPI client such as Postman.
### Management Endpoints
- Swagger UI: [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)
- OpenAPI spec: [http://localhost:8080/v3/api-docs](http://localhost:8080/v3/api-docs)
- H2 Console: [http://localhost:8080/h2-console](http://localhost:8080/h2-console)
### H2 Credentials
- Username: `sa`
- Password: ``
## License
This project is licensed under the MIT License.