openapi

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package openapi 实现 `gow openapi`:用 gnostic 的 protoc-gen-openapi 从项目的 proto 定义一键产出 OpenAPI 3.0 文档,为 `gow frontend gen` 供料——打通 DDL → 后端 → OpenAPI → 前端的纯 CLI 全栈闭环。

Index

Constants

This section is empty.

Variables

View Source
var CmdOpenAPI = &cobra.Command{
	Use:   "openapi [dir]",
	Short: "从 proto 定义生成 OpenAPI 3.0 文档",
	Long: `在指定目录(默认 ./api)运行 buf generate,仅启用 protoc-gen-openapi
(gnostic)插件,把 google.api.http 注解的 proto 服务转换为一份 OpenAPI 3.0
文档,供前端生成(gow frontend)或文档站点消费。

产物默认写在 <dir>/openapi.yaml;--out 可指定目标文件或目录(目录时写入
<out>/openapi.yaml,例如 app/admin/service/cmd/server/assets)。

依赖:
  buf        https://buf.build/docs/installation
  protoc-gen-openapi
             go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest`,
	Args:         cobra.MaximumNArgs(1),
	RunE:         Run,
	SilenceUsage: true,
}

CmdOpenAPI `gow openapi` 命令。

Functions

func Run

func Run(cmd *cobra.Command, args []string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL