swagger-codegen
Generate API client code from OpenAPI specs
TLDR
Generate client
SYNOPSIS
swagger-codegen command [-i input] [-l language] [-o output] [options]
DESCRIPTION
swagger-codegen generates API client libraries, server stubs, and documentation from OpenAPI (Swagger) specification files. It reads a YAML or JSON API definition and produces code in dozens of target languages and frameworks including Java, Python, TypeScript, Go, Ruby, and many more.
Client generation creates ready-to-use SDK code with models, API classes, and serialization logic matching the API specification. Server stub generation scaffolds backend code with route definitions and request/response models. Documentation generation produces HTML or other formats.
The tool uses Mustache templates that can be customized to control the exact output format. A configuration file can specify additional options such as package names, model naming conventions, and library preferences for the target language.
PARAMETERS
generate
Generate code.langs
List languages.validate
Validate spec.-i FILE
Input spec file.-l LANG
Target language.-o DIR
Output directory.-c FILE
Config file.
CAVEATS
Java required. Large dependency. Consider openapi-generator.
HISTORY
swagger-codegen was created for generating API client libraries from OpenAPI/Swagger specifications.
SEE ALSO
openapi-generator(1), oapi-codegen(1)
