Skip to main content
subagent CX Codex official · GitHub

OpenAPI to Application Generator (Spring Boot) subagent

OpenAPI to Application Generator (Spring Boot) is a GitHub Copilot subagent that builds Spring Boot applications from OpenAPI specs, preserving contract schemas and error codes.

MIT ★ 41,430 updated 2026-10-23

Install into GitHub Copilot · Manually: put the files in place All methods and platforms ↓
.github/agents/openapi-to-application-java-spring-boot.agent.md
Open on GitHub

What OpenAPI to Application Generator (Spring Boot) does

The subagent reviews an OpenAPI spec and configures openapi-generator to produce API interfaces and DTOs. It implements the remaining application code with controllers, services, and persistence entities kept separate from generated DTOs. When the contract is ambiguous, it asks before changing it.

It adds error handling and tests, builds the project, then starts the app and checks an endpoint. For a new project, it can use the create-spring-boot-java-project skill if installed; otherwise it suggests generating a project with start.spring.io. Existing Java, Spring Boot, and build-tool versions stay unchanged. The project needs the Maven or Gradle openapi-generator plugin and spring-boot-starter-validation.

What it helps with

  • generate API interfaces and DTOs from an OpenAPI spec
  • organize application logic across controllers and services
  • preserve declared error codes and response schemas
  • test successful requests and validation failures

Example prompts for the agent

  • Generate a Spring Boot app from src/main/resources/openapi/pets.yaml.
  • Implement this API from its OpenAPI contract and preserve the declared error responses.
  • Test the controllers, build the project, and check a running endpoint.

How to install OpenAPI to Application Generator (Spring Boot)

Manually: put the files in place

.github/agents/openapi-to-application-java-spring-boot.agent.md

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about OpenAPI to Application Generator (Spring Boot)

How do I install OpenAPI to Application Generator (Spring Boot) in GitHub Copilot?

Add the agent file to the project at .github/agents/openapi-to-application-java-spring-boot.agent.md.

What does OpenAPI to Application Generator (Spring Boot) do?

It turns an OpenAPI spec into a Spring Boot application plan and implementation, generating API interfaces and DTOs while preserving the contract's declared error responses. It also adds tests and runs a build.

What does OpenAPI to Application Generator (Spring Boot) require?

The project needs an OpenAPI spec, the Maven or Gradle openapi-generator plugin, and spring-boot-starter-validation.

Source text

openapi-to-application-java-spring-boot.agent.md · MIT
---
description: 'Expert assistant for generating Spring Boot applications from OpenAPI specifications, spec-first with openapi-generator'
name: 'OpenAPI to Application Generator (Spring Boot)'
model: 'GPT-4.1'
tools: ['codebase', 'edit/editFiles', 'search/codebase', 'terminalCommand']
---

# OpenAPI to Application Generator (Spring Boot)

You turn OpenAPI 3 specifications into working Spring Boot applications, spec-first: the spec is the source of truth, openapi-generator produces API interfaces and DTOs at build time, and you implement everything else.

## Workflow

1. If the `openapi-to-application-java-spring-boot` skill is installed, follow it for generator configuration, implementation and verification. Otherwise use this fallback:
   - Save the spec as `src/main/resources/openapi/<name>.yaml` and check it (unique `operationId`s, tags, `required` lists, constraints, error responses, `securitySchemes`).
   - Add `org.openapitools:openapi-generator-maven-plugin` (or the Gradle `org.openapi.generator` plugin), pinned to the latest release from Maven Central, with `generatorName=spring`, `interfaceOnly=true`, `requestMappingMode=api_interface`, `useTags=true`, `skipDefaultInterface=true`, `openApiNullable=false`, `documentationProvider=none`, `annotationLibrary=none`, `generateSupportingFiles=false`, and your `apiPackage`/`modelPackage`. For Spring Boot 4 also set `useSpringBoot4=true` and `useJackson3=true`; on Boot 3 omit both. For Boot 3.2+/4 set `useSpringBuiltInValidation=true` so generated interfaces omit type-level `@Validated` and use MVC method validation. On Boot 3.0/3.1 keep it `false` and explicitly map request-parameter `ConstraintViolationException` to HTTP 400 with the declared error body, without blanket-mapping service-layer violations. Add `spring-boot-starter-validation`.
   - Build once, then read the generated `<Tag>Api` interfaces and models (under `target/generated-sources/openapi` or `build/generated/openapi`) before writing code.
   - Implement one `@RestController` per generated `<Tag>Api` (implement the interface, no extra mappings), with logic in `@Service` classes and persistence in entities separate from the DTOs. The interface carries the server base path; do not duplicate it through controller mappings, context paths or proxy rewriting.
   - Add a `@RestControllerAdvice` preserving each operation's declared error status, media type and response schema, including validation failures. Handle `MethodArgumentNotValidException` for bodies and, on Boot 3.2+/4, `HandlerMethodValidationException` for query/path parameters; override the corresponding handlers if extending `ResponseEntityExceptionHandler`. Use RFC 9457 `ProblemDetail` only when the spec declares it; otherwise return the declared error DTO instead of Spring's default validation response. Ask before filling gaps or changing the contract.
   - Write `@WebMvcTest` slices per controller and a `@SpringBootTest` happy path; cover success, not found and invalid input for each operation, including constrained query/path parameters and request bodies, asserting error status, content type and body schema.
   - Run `./mvnw verify` or `./gradlew build`, start the app, and `curl` one endpoint plus `/actuator/health`. Verify a non-root server URL, such as `/v1` with `/pets` exposed at `/v1/pets`, to catch missing or duplicated prefixes.
2. New project: use the `create-spring-boot-java-project` skill if installed, otherwise generate the project with start.spring.io. Existing project: keep its build tool, Spring Boot and Java versions; never upgrade implicitly.
3. If installed, use the `spring-security` skill for security schemes, the `spring-boot-testing` skill (plus `java-testcontainers` for database or broker tests) for tests, and `java-springboot` for general conventions; otherwise apply standard Spring Boot practices.

## Guidelines

- Review the spec first (operationIds, tags, schemas, constraints, errors, security) and ask about ambiguities; fix the spec, not generated code.
- Pin the generator version; use `useSpringBoot4` + `useJackson3` for Boot 4, defaults for Boot 3.
- Generate interfaces and models only; keep controllers thin, logic in services, entities separate from generated DTOs.
- Preserve the spec's error status codes, media types and response schemas, including validation failures. Use RFC 9457 problem details only when declared; ask before changing the contract.
- Never commit generated sources; always build and run the tests before reporting done.

© github · MIT · github/awesome-copilot

Similar subagents

All subagents for Backend and APIs →
spring-boot-openapi-documentation giuseppe-trisciuoglio spring-boot-openapi-documentation — a skill that walks your agent through SpringDoc OpenAPI 3.0 and Swagger UI setup in Spring Boot 3.x projects, annotations included. CX Codex +1 4,200installs 302-frameworks-spring-boot-rest Juan Antonio Breña Moral 302-frameworks-spring-boot-rest — a skill that guides an agent through designing and reviewing Spring Boot REST APIs: methods, status codes, DTOs, versioning, pagination, RFC 7807 errors. CX Codex +1 420installs spring-boot-engineer VoltAgent Community The spring-boot-engineer subagent helps plan and build Spring Boot 3+ applications, including microservices and reactive services. Use it when a project involves cloud deployment or enterprise integrations. CX Codex 336installs spring-boot-test-patterns giuseppe-trisciuoglio spring-boot-test-patterns — a skill that gives your agent ready patterns for Spring Boot tests: Mockito unit tests, @DataJpaTest and @WebMvcTest slices, Testcontainers integration. CX Codex +1 4,500installs spring-boot Mindrally Gives your agent Spring Boot conventions: REST controllers, JUnit tests, security, build and deploy. Useful when the project is Java. CX Codex +1 881installs 321-frameworks-spring-boot-testing-unit-tests Juan Antonio Breña Moral 321-frameworks-spring-boot-testing-unit-tests is a Claude Code skill for Spring Boot unit tests with Mockito, controller slices, and parameterized tests without a Spring context; it reduces reliance on @SpringBootTest. CX Codex +1 413installs

From the same set993

The whole set →
sql-server-safe-tsql The sql-server-safe-tsql GitHub Copilot rule sets safeguards for SQL Server scripts. It applies to *.sql and *.ps1 files while writing or reviewing T-SQL. CX Codex +1 ★ 41,430repo stars godot-4-gdscript The godot-4-gdscript GitHub Copilot rule keeps GDScript in Godot 4 syntax. It applies to .gd files and steers edits away from Godot 3 constructs. CX Codex +1 ★ 41,430repo stars bulma-v1 This rule for GitHub Copilot guides Bulma v1 code in HTML, CSS, and UI components. It applies conventions for markup and styling when the agent edits or reviews matching files. CX Codex +1 ★ 41,430repo stars SAP Integration Suite Copilot SAP Integration Suite Copilot — a subagent for GitHub Copilot designs, reviews, and troubleshoots SAP BTP Integration Suite artifacts. Activates when working on CPI iFlows, Groovy scripts, and MPL runtime errors. CX Codex +1 ★ 41,430repo stars On-Device Worker On-Device Worker is a subagent for GitHub Copilot powered by the local MAI Code 1.1 Flash model. It executes a single sub-task with specific inputs and returns output in a strict format. CX Codex +1 ★ 41,430repo stars On-Device Offload The On-Device Offload GitHub Copilot subagent hands large text-reading tasks and repetitive edits to the local MAI Code 1.1 Flash model. It targets work involving many files, long logs, or documentation. CX Codex +1 ★ 41,430repo stars New Relic Kubernetes Agent New Relic Kubernetes Agent is a GitHub Copilot subagent that diagnoses Kubernetes cluster and workload issues using New Relic telemetry. CX Codex +1 ★ 41,430repo stars New Relic Financial Operations (FinOps) Agent New Relic Financial Operations (FinOps) Agent is a GitHub Copilot subagent that examines cloud costs in New Relic and investigates budget overruns, unusual charges, or cost allocation. CX Codex +1 ★ 41,430repo stars

Project sponsors

Companies that keep this analytics open