# 使用 Homebrew, MacPorts, Nix 安装 swagger-codegen

查看 swagger-codegen 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:swagger-codegen
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install swagger-codegen
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install swagger-codegen
```

  证据: MacPorts ports tree: devel/swagger-codegen/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#swagger-codegen
```

  证据: nixpkgs package indexes: pkgs/by-name/sw/swagger-codegen/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:swagger-codegen
- **软件包管理器:** Homebrew
- **版本:** 3.0.81
- **来源摘要:** Generate clients, server stubs, and docs from an OpenAPI spec
- **主页:** <https://swagger.io/tools/swagger-codegen/>
- **仓库:** <https://github.com/swagger-api/swagger-codegen>
- **最后更新:** 2026-05-18T14:26:15Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- swagger-codegen (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 3.0.81
## 项目历史与用法

Swagger Codegen is the Swagger/OpenAPI project's command-line code generator for API clients, server stubs, and documentation. The Homebrew `swagger-codegen` formula tracks the modern 3.x line, which adds OpenAPI 3.0 support while sharing the long-running upstream repository.

### 项目历史

The swagger-api/swagger-codegen repository was created on GitHub in July 2011. Official Swagger documentation describes Swagger Codegen as a project that generates API client libraries, server stubs, and documentation automatically from an OpenAPI Description.

### 采用历史

Swagger Codegen became widely packaged because it is a single Java CLI that can generate code for many languages and frameworks. The official README lists client generators for languages including Java, Go, Python, Ruby, PHP, Swift, TypeScript, and many others, plus server stubs and documentation outputs.

### 使用方式

The common CLI pattern is to run the codegen jar with `generate`, pass an input spec with `-i`, select a target language with `-l`, and choose an output directory with `-o`. Official docs also describe querying generator capabilities and integrating generation into Maven, Gradle, Docker, GitHub, and CI workflows.

### 为什么软件包爱好者会关心

For package-manager users, Swagger Codegen is important because it converts API descriptions into language-specific source trees without requiring each language ecosystem to maintain its own generator. It is also a classic example of a large Java CLI distributed through system package managers, Maven artifacts, Docker, and release jars.

### 时间线

- 2011: GitHub repository created.
- 2014: v2.0.13 appears in GitHub releases.
- 2018: v3.0.0 released with the 3.x line.
- 2025: Official docs list 3.0.71 as a stable 3.x release with OpenAPI 3.0 compatibility.
- 2026: GitHub releases list later 3.x releases during research.

### Related projects

- The official docs tie Swagger Codegen to the OpenAPI Specification and Swagger tooling. The README also points to Swagger online generators, a validator, and workflow integrations.

### 来源

- <https://api.github.com/repos/swagger-api/swagger-codegen>
- <https://api.github.com/repos/swagger-api/swagger-codegen/releases>
- <https://github.com/swagger-api/swagger-codegen#readme>
- <https://swagger.io/docs/open-source-tools/swagger-codegen/codegen-v3/about>


## 安全说明

没有找到 swagger-codegen 的匹配本地密钥处理 manifest。Nucleus 软件包元数据仍在此发布，以便未来覆盖拥有稳定的软件包 URL。


## 其他软件包管理器记录

- Nix - swagger-codegen: normalized package name match | nixpkgs package indexes: pkgs/by-name/sw/swagger-codegen/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- MacPorts - swagger-codegen: normalized package name match | MacPorts ports tree: devel/swagger-codegen/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/swagger-codegen.yml](https://github.com/mxcl/pkgdb/blob/main/combined/swagger-codegen.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
