add-openapi-codegen

Configure OpenAPI Generator 7.21.0 for Spring Boot 4 and Jackson 3.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-openapi-codegen
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: add-openapi-codegen
Source: https://github.com/dprice-dev/claude-java-skills/tree/main/.claude/skills/add-openapi-codegen
Command: npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-openapi-codegen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of keeping a Spring Boot REST contract and its generated Java API/DTO types synchronized, without manually editing controllers or models whenever the HTTP contract changes.

Core Features & Use Cases

  • Spec-first OpenAPI Generator integration: pins and applies the OpenAPI Generator plugin, validates src/main/resources/openapi/api.yaml, and regenerates code on rebuild.
  • Spring Boot 4 + Jackson 3 compatible output: configures generator options to target Spring Boot 4 and Jackson 3 while generating interface-only API contracts split by tags.
  • Build + compile wiring: adds generated sources to main and establishes openApiValidate → openApiGenerate → compileJava dependencies for deterministic behavior.
  • Quality gates that ignore generated code: excludes generated api/** and dto/** from JaCoCo (and PIT, if present) so coverage/mutation metrics reflect hand-written code.
  • Seed spec setup: creates a starter api.yaml with paths: {} so the project builds and generation starts once endpoints are added.

Quick Start

Run add-openapi-codegen on your existing Spring Boot 4 project to validate and generate code from src/main/resources/openapi/api.yaml.

Frequently Asked Questions about add-openapi-codegen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate type-safe APIs from an OpenAPI spec in a Spring Boot 4 project?▼

To generate type-safe APIs from an OpenAPI spec in Spring Boot 4, apply the OpenAPI Generator plugin to validate `src/main/resources/openapi/api.yaml` and generate interface-only API contracts and DTOs targeting Spring Boot 4 and Jackson 3.

What's the best way to exclude generated OpenAPI code from JaCoCo coverage in Gradle?▼

The best way to exclude generated OpenAPI code from JaCoCo coverage is configuring the build to ignore generated `api/**` and `dto/**` packages, ensuring coverage and mutation metrics reflect only hand-written code rather than spec-generated artifacts.

Does OpenAPI Generator work with Gradle Kotlin DSL for Spring Boot 4?▼

Yes, OpenAPI Generator works with Gradle Kotlin DSL for Spring Boot 4 by pinning plugin version 7.21.0 and configuring specific generator options for Spring Boot 4 and Jackson 3 compatibility during the build process.

Why does my generated OpenAPI code fail to compile during tests in Gradle?▼

Generated OpenAPI code might fail to compile if task dependencies are not wired correctly. You must establish `openApiValidate → openApiGenerate → compileJava` dependencies to add generated sources to `main` for deterministic compile flows.

Can I start OpenAPI code generation before adding any endpoints to my spec?▼

Yes, you can start OpenAPI code generation before adding endpoints by creating a starter `api.yaml` file with `paths: {}`. This allows the project to build successfully and generation to run once endpoints are added.

How do I configure OpenAPI Generator to split API interfaces by tags for Spring Boot?▼

To split API interfaces by tags for Spring Boot, configure the OpenAPI Generator options to produce interface-only API contracts grouped by tags, targeting Spring Boot 4 and Jackson 3 directly from your OpenAPI specification file.