Skip to content

Releases: fox-gonic/openapi

v0.4.0

Choose a tag to compare

@miclle miclle released this 09 May 11:55
af8050b

What's Changed

  • Add a post-generation OpenAPI filter pipeline with Go API support via WithFilters.
  • Add CLI/config filters with repeatable --filter expressions and --prune-unused-components.
  • Support filtering operation extensions, OR alternatives, numeric/bool/string literals, and safe scalar comparisons.
  • Add unused component pruning for schemas, responses, parameters, examples, request bodies, headers, security schemes, links, and callbacks while preserving discriminator mappings and operationRef references.
  • Update English and Chinese README docs for manifest generation, entry compatibility, and filtering workflows.

Verification

  • go test ./...

v0.3.0

Choose a tag to compare

@miclle miclle released this 07 May 14:37

Highlights

  • Add route manifest mode so fox-openapi can generate OpenAPI documents from an exported Fox route manifest without running the application entry.
  • Support --route-manifest and routeManifest config for manifest-based generation.
  • Enrich manifest handler symbols from source packages, including aliases, generic wrappers, value receivers, and optional _test.go handlers.
  • Infer status-wrapper responses more accurately and avoid exposing render wrapper types as public schemas.
  • Document the v0.3.0 manifest workflow in both English and Simplified Chinese README files.

Upgrade Notes

For reproducible CI installs:

go install github.com/fox-gonic/openapi/cmd/fox-openapi@v0.3.0

Manifest mode expects a compatible Fox route manifest, typically produced by fox.WriteRouteManifest(engine, path), then consumed with:

fox-openapi generate --route-manifest api/routes.manifest.json --out api/openapi.yaml

Full Changelog: v0.2.1...v0.3.0

v0.2.1

Choose a tag to compare

@miclle miclle released this 05 May 05:51
c88eb8e

🐛 修复

  • fox-openapi version 不再硬编码输出 "dev":之前 var version = \"dev\" 没有任何注入机制,go install github.com/fox-gonic/openapi/cmd/fox-openapi@vX.Y.Z 安装的二进制运行 version 命令也只会得到 "dev"。现在改用 runtime/debug.ReadBuildInfo() 解析模块版本:
    1. -ldflags \"-X main.version=...\" 覆盖(CI/release 构建可注入)
    2. runtime/debug.ReadBuildInfo()Main.Versiongo install module@vX.Y.Z 自动报告 tag
    3. VCS revision (+dirty) 用于源码 go build
    4. 兜底 "dev"

✅ 验证

升级后:

```bash
go install github.com/fox-gonic/openapi/cmd/fox-openapi@v0.2.1
fox-openapi version

v0.2.1

```

Full Changelog: v0.2.0...v0.2.1

v0.2.0

Choose a tag to compare

@miclle miclle released this 05 May 02:49
34a9f5e

✨ 新特性

  • Entry 函数自动发现:CLI 现在会扫描 sources 自动定位符合 entry 签名的导出函数,零候选/多候选均给出明确诊断
  • // fox-openapi:entry 标记:在多个 entry 形状函数共存时,无需删除其他辅助函数即可消歧
  • 位置参数限定发现范围fox-openapi generate ./internal/server 仅缩小 entry 查找范围,注释提取仍按模块全量扫描,子包字段/handler 描述不再丢失
  • 路径解析对齐 Go 工具链约定:CLI flags 相对 CWD、YAML 字段相对配置目录、位置参数仅作发现范围
  • serve 默认挂载 swagger/scalar/redoc,并打印 entry/spec/ui 启动 banner
  • generate/check/init 同步输出 entry 信息(含 auto-discovered 标记)

🛠 改进

  • 复用 matchEntrySignature 共享 entry 签名校验
  • 缓存 ResolvedEntry 跳过 pipeline 中重复的 packages.Load
  • normalizeSourcePattern 处理裸目录避免被 go/packages 识别为 stdlib import
  • init [path] 路径无效时显式报错而非静默回退
  • 简化 hasEntryMarker:使用 ast.CommentGroup.Text() 统一处理注释格式
  • serve UI 路由用结构体而非字符串拼接,避免按空格切分

📚 文档

  • 中英文 README 同步更新:自动发现、marker、路径解析规则

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@miclle miclle released this 04 May 07:32
8da5f06

Changes

  • Initial standalone OpenAPI module release.
  • Add fox-openapi generate/check/serve/version CLI.
  • Add config loading, runtime driver generation, offline UI assets, examples, docs, and CI fixture.

Dependency

  • Requires github.com/fox-gonic/fox v0.0.11 or newer.