Linux command
openapi-generator 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Generate client library
openapi-generator generate -i [spec.yaml] -g [python] -o [./client]
Generate server stub
openapi-generator generate -i [spec.yaml] -g [spring] -o [./server]
List available generators
openapi-generator list
Generate with config file
openapi-generator generate -i [spec.yaml] -g [typescript-axios] -c [config.yaml] -o [./client]
Validate spec
openapi-generator validate -i [spec.yaml]
Generate documentation
openapi-generator generate -i [spec.yaml] -g [html2] -o [./docs]
说明
OpenAPI Generator generates API clients, server stubs, and documentation from OpenAPI (Swagger) specifications. It supports 50+ languages and frameworks. The tool is a fork of Swagger Codegen with active community development.
参数
- generate
- Generate code.
- validate
- Validate spec.
- list
- List generators.
- -i _file_
- Input spec file.
- -g _generator_
- Generator name.
- -o _dir_
- Output directory.
- -c _file_
- Config file.
- -p _params_
- Additional properties.
FAQ
What is the openapi-generator command used for?
OpenAPI Generator generates API clients, server stubs, and documentation from OpenAPI (Swagger) specifications. It supports 50+ languages and frameworks. The tool is a fork of Swagger Codegen with active community development.
How do I run a basic openapi-generator example?
Run `openapi-generator generate -i [spec.yaml] -g [python] -o [./client]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does generate do in openapi-generator?
Generate code.