Why Self-Host Your Code Generation Pipeline

When your team builds APIs, writing client SDKs, server stubs, and boilerplate by hand is a massive time sink. Code generation tools automate this by reading an API specification (OpenAPI/Swagger, AsyncAPI, or custom templates) and producing production-ready code in dozens of languages and frameworks.

Self-hosting your code generation pipeline gives you full control over the build environment, custom templates, and integration with your CI/CD system. You avoid vendor lock-in, keep proprietary API specs internal, and can run generation as part of automated deployment pipelines. For teams practicing API-first development, having a self-hosted code generation tool is a cornerstone of efficient, consistent API delivery.

In this guide, we compare three of the most widely used open-source code generation platforms: OpenAPI Generator, Swagger Codegen, and JHipster. Each takes a different approach — from pure spec-to-code generation to full-stack application scaffolding — and we’ll help you pick the right one for your workflow.

OpenAPI Generator vs Swagger Codegen vs JHipster at a Glance

FeatureOpenAPI GeneratorSwagger CodegenJHipster
GitHub Stars26,100+17,700+22,400+
Primary FocusAPI client & server stub generationAPI client & server stub generationFull-stack application generation
Supported Languages60+ (Java, Python, Go, TypeScript, C#, PHP, Rust, etc.)40+ (Java, Python, Go, TypeScript, C#, PHP, etc.)Java/Spring Boot, Angular, React, Vue
OpenAPI Spec Supportv2.0, v3.0, v3.1v2.0, v3.0v3.0 (via embedded OpenAPI)
Custom TemplatesYes (Mustache, Handlebars)Yes (Mustache)Yes (EJS, JDL templates)
Docker SupportOfficial Docker imageOfficial Docker imageOfficial Docker image (JHipster)
CLI ToolYes (openapi-generator-cli)Yes (swagger-codegen-cli)Yes (jhipster CLI)
Web InterfaceNo (CLI-only)No (CLI-only)No (CLI-only, but generates full web apps)
LicenseApache 2.0Apache 2.0Apache 2.0
Last Active UpdateApril 2026April 2026April 2026

OpenAPI Generator is the most actively maintained of the three, with a fork of Swagger Codegen that has grown far beyond its predecessor. It supports the widest range of languages and frameworks and is the de facto standard for OpenAPI-based code generation.

Swagger Codegen is the original project that started it all. While still maintained, most of its active development has shifted to OpenAPI Generator. It remains a solid choice for teams already invested in the Swagger ecosystem.

JHipster takes a completely different approach — it generates entire full-stack applications (backend + frontend + database + Docker) from a domain model described in JHipster Domain Language (JDL). It’s less about generating code from an API spec and more about scaffolding complete microservice architectures.

OpenAPI Generator: The Community Standard

OpenAPI Generator is a community-driven project that forked from Swagger Codegen in 2018 and has since become the most comprehensive OpenAPI code generation tool available. It supports over 60 programming languages and frameworks, with generators for client SDKs, server stubs, API documentation, and configuration files.

Key Features

  • Massive language support — Generate code in Java (Spring, Jersey, RestTemplate), Python (Flask, FastAPI, aiohttp), Go, TypeScript (Angular, Axios, Fetch), C# (.NET Standard), PHP (Symfony, Laravel), Rust, Kotlin, and many more.
  • OpenAPI v3.1 support — Full support for the latest OpenAPI specification, including new schema features and webhook definitions.
  • Custom templates — Override any generator’s output with your own Mustache or Handlebars templates to match your team’s coding standards.
  • Plugin ecosystem — Integrates with Maven, Gradle, npm, and CLI pipelines.
  • Validation — Built-in spec validation catches issues before code generation.

Docker Setup

OpenAPI Generator provides an official Docker image that makes it easy to run in any environment, including CI/CD pipelines:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
version: "3.8"

services:
  openapi-generator:
    image: openapitools/openapi-generator-cli:v7.12.0
    volumes:
      - ./api-specs:/specs
      - ./generated-code:/output
    command: >
      generate
      -i /specs/openapi.yaml
      -g python
      -o /output/python-client
      --additional-properties=packageName=myapi_client,packageVersion=1.0.0

You can run it directly with Docker for quick one-off generation:

1
2
3
4
5
6
7
docker run --rm \
  -v "${PWD}:/local" \
  openapitools/openapi-generator-cli:v7.12.0 \
  generate \
  -i /local/api/openapi.yaml \
  -g typescript-axios \
  -o /local/generated/typescript

Installation

For local development, install the CLI via npm:

1
npm install @openapitools/openapi-generator-cli -g

Or use the Java-based JAR directly:

1
2
3
4
5
6
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.12.0/openapi-generator-cli-7.12.0.jar \
  -O openapi-generator-cli.jar
java -jar openapi-generator-cli.jar generate \
  -i openapi.yaml \
  -g python-flask \
  -o ./generated-server

CI/CD Integration

A typical GitLab CI pipeline that generates client SDKs on every API spec change:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
generate-sdks:
  image: openapitools/openapi-generator-cli:v7.12.0
  script:
    - openapi-generator-cli generate
      -i api/openapi.yaml
      -g python
      -o sdks/python
      --git-repo-id=python-sdk
      --git-user-id=myorg
    - openapi-generator-cli generate
      -i api/openapi.yaml
      -g go
      -o sdks/go
      --package-name=myapi
  artifacts:
    paths:
      - sdks/
  only:
    changes:
      - api/openapi.yaml

Swagger Codegen: The Original

Swagger Codegen is the project that pioneered API-first code generation. It reads Swagger/OpenAPI specifications and generates client libraries, server stubs, and documentation. While OpenAPI Generator has overtaken it in terms of active development and language support, Swagger Codegen remains a viable option, especially for legacy projects.

Key Features

  • Mature and stable — Years of production use across thousands of organizations.
  • Mustache templating — Customize output with Mustache templates.
  • Swagger 2.0 and OpenAPI 3.0 — Supports both specification versions.
  • Maven/Gradle plugins — Direct integration with Java build systems.
  • Online generator — The Swagger Editor includes a built-in code generation feature (though self-hosting the CLI is recommended for production).

Docker Setup

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
version: "3.8"

services:
  swagger-codegen:
    image: swaggerapi/swagger-codegen-cli-v3:3.0.67
    volumes:
      - ./specs:/specs
      - ./output:/output
    command: >
      generate
      -i /specs/openapi.yaml
      -l spring
      -o /output/spring-server
      --invoker-package=com.myapi.client
      --api-package=com.myapi.api
      --model-package=com.myapi.model

Direct Docker usage:

1
2
3
4
5
6
7
docker run --rm \
  -v "${PWD}:/local" \
  swaggerapi/swagger-codegen-cli-v3:3.0.67 \
  generate \
  -i /local/openapi.yaml \
  -l typescript-angular \
  -o /local/generated/angular-client

Installation

Install via npm:

1
npm install swagger-codegen-cli -g

Or download the JAR:

1
2
3
4
5
6
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.67/swagger-codegen-cli-3.0.67.jar \
  -O swagger-codegen-cli.jar
java -jar swagger-codegen-cli.jar generate \
  -i openapi.yaml \
  -l java \
  -o ./generated-java-client

JHipster: Full-Stack Application Generation

JHipster takes a fundamentally different approach. Rather than generating code from an API spec, it generates complete, production-ready applications from a domain model. You describe your entities, relationships, and configuration in JDL (JHipster Domain Language), and JHipster scaffolds the entire stack: Spring Boot backend, Angular/React/Vue frontend, Liquibase database migrations, Docker Compose files, and CI/CD pipelines.

Key Features

  • Full-stack generation — Backend (Spring Boot), frontend (Angular, React, Vue), database schema, and deployment configs all in one command.
  • Microservice architecture — Generate complete microservice setups with API Gateway, service registry (Consul/Eureka), and centralized configuration.
  • JDL Studio — Visual online editor for JDL domain models (self-hostable).
  • Built-in authentication — JWT, OAuth2, OIDC support out of the box.
  • Production-ready defaults — Security, caching, metrics, logging, and monitoring pre-configured.
  • Upgrade supportjhipster upgrade merges your custom changes with the latest JHipster version.

Docker Setup

JHipster can run in Docker and generate applications that include their own Docker Compose configurations:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
version: "3.8"

services:
  jhipster:
    image: jhipster/jhipster:v8.7.0
    volumes:
      - ./my-app:/home/jhipster/app
      - ~/.m2:/home/jhipster/.m2
      - ~/.gradle:/home/jhipster/.gradle
    working_dir: /home/jhipster/app
    command: jhipster --skip-git --no-insight

Installation

Install via npm:

1
npm install -g generator-jhipster

Create a new application:

1
2
mkdir my-app && cd my-app
jhipster

Or use JDL to define your domain model:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// app.jdl
entity User {
  firstName String required
  lastName String required
  email String required unique
  activated Boolean required
}

entity Product {
  name String required
  price BigDecimal required
  description TextBlob
}

entity Order {
  orderDate Instant required
  status OrderStatus required
}

enum OrderStatus {
  PENDING, CONFIRMED, SHIPPED, DELIVERED, CANCELLED
}

relationship OneToMany {
  User{order} to Order{user}
  Order{product} to Product{orderItems}
}

dto * with mapstruct
service * with serviceImpl
paginate * with pagination

Then generate:

1
jhipster import-jdl app.jdl

This produces a complete Spring Boot application with REST APIs, a React/Angular/Vue frontend, database migrations, and Docker Compose files for the application and its dependencies.

Choosing the Right Tool

The decision comes down to what you’re trying to accomplish:

ScenarioRecommended Tool
Generate client SDKs for an existing APIOpenAPI Generator
Generate server stubs from an OpenAPI specOpenAPI Generator
Maintain legacy Swagger 2.0 integrationsSwagger Codegen
Scaffold a complete new microservice applicationJHipster
Need TypeScript/Angular client from specOpenAPI Generator
Need Spring Boot + Angular full-stack appJHipster
Multi-language SDK publishing pipelineOpenAPI Generator
Rapid prototyping of CRUD applicationsJHipster

Why Not Both?

Many teams use OpenAPI Generator for SDK generation alongside JHipster for application scaffolding. JHipster can export OpenAPI specs from its generated applications, which you then feed into OpenAPI Generator to produce client SDKs for other teams. This creates a clean API-first development cycle.

FAQ

What is the difference between OpenAPI Generator and Swagger Codegen?

OpenAPI Generator is a community-driven fork of Swagger Codegen that supports more languages (60+ vs 40+), has more active development, and supports OpenAPI v3.1. Swagger Codegen is the original project and is still maintained but receives fewer updates. For new projects, OpenAPI Generator is generally recommended.

Can JHipster generate code from an OpenAPI specification?

Not directly. JHipster uses its own JDL (JHipster Domain Language) to describe domain models and relationships. However, JHipster-generated applications include OpenAPI-compliant REST APIs, and you can export the OpenAPI spec from a running JHipster application. You can then use that spec with OpenAPI Generator to create client SDKs.

Do these tools require a web interface to run?

No. All three tools are CLI-based. You run them from the command line or integrate them into CI/CD pipelines. JHipster generates applications that include web interfaces, but the generator itself is a CLI tool. For teams that want a web-based experience, you can wrap the CLI in a simple HTTP service or use it within a development container.

How do I customize the generated code?

All three tools support custom templates. OpenAPI Generator and Swagger Codegen use Mustache templates — you copy the built-in templates, modify them, and point the generator to your custom template directory. JHipster uses EJS templates and supports Blueprint modules that override or extend any part of the generation process.

Can I run these tools in a CI/CD pipeline?

Yes. All three provide official Docker images and can be run as CI/CD steps. OpenAPI Generator is particularly well-suited for pipelines — you can configure it to regenerate SDKs automatically whenever your OpenAPI spec changes, then publish the updated SDKs to your package registry.

Which tool supports the latest OpenAPI 3.1 specification?

OpenAPI Generator has the best OpenAPI 3.1 support, including new schema features like unevaluatedProperties, dependent schemas, and webhooks. Swagger Codegen supports OpenAPI 3.0 but has limited 3.1 coverage. JHipster uses OpenAPI 3.0 internally for its generated API documentation.

For related reading, see our API documentation generators guide and API gateway comparison. You may also find our code quality tools guide useful for setting up comprehensive developer pipelines.