$ show swagger-api/swagger-codegen-generators
This is the swagger-codegen-generators repository, a Java library that provides code generation for client and server stubs from OpenAPI (formerly Swagger) specifications. It is not a standalone application but a library consumed by the swagger-codegen v3 tool (or used programmatically). The codebase implements a template-driven architecture where language-specific generators extend abstract base classes (e.g., AbstractJavaCodegen, AbstractTypeScriptClientCodegen) and use Handlebars/Mustache templates to produce output. It supports a wide range of languages including Java, C#, Go, Python, Ruby, Swift, TypeScript, Kotlin, Dart, PHP, Scala, R, and Node.js, with frameworks like Spring, JAX-RS, Micronaut, Vert.x, ASP.NET Core, and more. Key file patterns include feature interfaces for composable generator capabilities (e.g., BeanValidationFeatures, GzipFeatures), Handlebars helper lambdas for template logic, and schema handlers for composed schemas (allOf/oneOf/anyOf). The project has extensive test coverage with unit and integration tests for model and API generation. While the core architecture is solid, the base class DefaultCodegenConfig is monolithic and the hundreds of template files pose maintenance drift risks. The project is actively maintained with CI workflows, issue templates, and recent commits.
The LLM identified 2 files worth highlighting for reuse:
Generates example JSON values from OpenAPI schemas by recursively resolving types and constraints. It handles allOf/oneOf/anyOf, enums, arrays, maps, and nested objects. This component is self-contained (depends only on OpenAPI model classes) and can be extracted and reused in any project needing to produce sample data from OpenAPI schemas, such as documentation generators, mock servers, or API testing tools.
A Handlebars Lambda that converts a string to camelCase format (e.g., 'foo_bar' -> 'fooBar'). It is a self-contained, stateless function that can be registered as a Handlebars helper in any template-driven code generator or any application using Handlebars templates. It demonstrates a clean, testable pattern for template-level string manipulation without polluting template logic.