API specification for a Book Publishing system with automatic Kotlin Spring code generation.
This repository contains the OpenAPI 3.1.2 specification for a Book Publishing API that manages books, authors, and collections. The specification is automatically validated and used to generate Kotlin Spring Boot 3 compatible code.
- ✅ OpenAPI 3.1.2 specification with comprehensive CRUD operations
- ✅ Authentication & Authorization with Bearer token support
- ✅ Automatic validation on every pull request
- ✅ Kotlin Spring code generation with Jackson serialization
- ✅ GitHub Packages publishing for dependency consumption
- ✅ Automated release workflow with tag creation and package publishing
- ✅ Audit fields (created_at, created_by, updated_at, updated_by)
POST /api/v1/auth/login- Authenticate user and get access token
GET /api/v1/authors- Get all authors (paginated)POST /api/v1/authors- Create a new authorGET /api/v1/authors/{id}- Get author by IDPUT /api/v1/authors/{id}- Update authorDELETE /api/v1/authors/{id}- Delete author
GET /api/v1/books- Get all books (paginated)POST /api/v1/books- Create a new bookGET /api/v1/books/{id}- Get book by IDPUT /api/v1/books/{id}- Update bookDELETE /api/v1/books/{id}- Delete book
GET /api/v1/collections- Get all collections (paginated)POST /api/v1/collections- Create a new collectionGET /api/v1/collections/{id}- Get collection by IDPUT /api/v1/collections/{id}- Update collectionDELETE /api/v1/collections/{id}- Delete collection
- Java 21 or higher
# Validate OpenAPI specification
./gradlew openApiValidate
# Generate Kotlin Spring code
./gradlew openApiGenerate
# Build the project
./gradlew buildThe generated code includes:
- DTOs: Kotlin data classes for all schemas
- API Interfaces: Spring Boot 3 compatible interfaces for all endpoints
- Jackson Serialization: Configured for JSON serialization/deserialization
- Bean Validation: Jakarta validation annotations
- Security: Bearer token authentication support
Generated files are placed in build/generated-sources/openapi/.
Every pull request automatically runs:
- ✅ OpenAPI Specification Validation - Validates the YAML specification
- ✅ Build and Compilation - Generates code and verifies compilation
The release process is partially automated and consists of these steps:
- Go to Actions → Create Release Tag
- Run manually with the desired version (e.g.,
v0.1.0) - This creates a Git tag and GitHub release
- Go to Tags
- Click on the tag created in the previous step → Click on Release
- Autogenerate release notes
- Generate a GitHub Personal Access Token (PAT) with the
write:packagesscope and configure the GH secret - Go to Actions → Publish Package
- Run manually with the version (e.g.,
0.1.0)
- Configure the TOKEN environment variable with a GitHub Personal Access Token that has
read:packagesscope. - Add to your
build.gradle.kts:
repositories {
mavenCentral()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/CescFe/book-publishing-api-spec")
credentials {
username = System.getenv("USERNAME")
password = System.getenv("TOKEN")
}
}
}
dependencies {
implementation("org.cescfe:book-publishing-api-spec:0.1.0")
}- Group:
org.cescfe - Artifact:
book-publishing-api-spec - Version:
0.1.0(or latest) - Repository:
https://maven.pkg.github.com/CescFe/book-publishing-api-spec