Skip to content

CodeCraftByRamcharan/kanban-springdoc-codegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Kanban API — Spring Boot + OpenAPI Generator + H2 This project demonstrates how to use OpenAPI Generator (Swagger Codegen) with Spring Boot, H2 Database, and Swagger UI to build a fully documented Kanban API (Boards → Lists → Cards).

📘 Swagger / OpenAPI Code Generation

This project uses OpenAPI Generator to automatically generate:

API interfaces (BoardsApi, ListsApi, CardsApi)

API models (Board, BoardInput, ModelList, Card, CardInput)

Default controller signatures (methods returning HttpStatus.NOT_IMPLEMENTED)

🔧 How Code Generation Works 1️⃣ OpenAPI Specification

The file openapi.yml defines:

Paths: /boards, /boards/{boardId}/lists, /lists/{listId}/cards, /cards/{cardId}

Models & schemas

Request/response bodies

Tags and documentation

2️⃣ Maven Plugin — openapi-generator-maven-plugin <plugin> <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <version>7.5.0</version> <executions> <execution> <id>generate-sources</id> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>${project.basedir}/openapi.yml</inputSpec> <generatorName>spring</generatorName> <apiPackage>com.example.codegen.api</apiPackage> <modelPackage>com.example.codegen.model</modelPackage> <configOptions> <interfaceOnly>true</interfaceOnly> <dateLibrary>java8</dateLibrary> </configOptions> <output>${project.basedir}/generated-sources</output> </configuration> </execution> </executions> </plugin>

✔ What Gets Generated? Type-safe interface classes for each endpoint Model classes mapped directly from OpenAPI schemas Request/response validation logic Consistent API contract across services

🌐 Local Testing Swagger UI Access API docs: 👉 http://localhost:8080/swagger-ui.html H2 Database Console 👉 http://localhost:8080/h2-console JDBC URL: jdbc:h2:mem:kanban

About

A Spring Boot demo showing how to design an API using OpenAPI 3, generate models/controllers with Swagger Codegen, and implement real logic with service, JPA, and H2 DB. Includes Swagger UI, ReDoc, SpringDoc annotations, and a Trello-style Board/List/Card example.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages