Move OpenAPI UI hosting into Toolkit while keeping generated specs inside modules
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 48/100
- Issue 类型
- 重构
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- openapi, php
- 领域
- api, devtools, documentation
调研方向
从 src/Console/Commands/OpenApiCommand.php 和 src/Console/Commands/InstallToolkitCommand.php 开始,然后检查 Toolkit 模板、shared/views/openapi/openapi.php、public/assets/OpenApiUi 以及模块资源 resources/openapi/spec.json。追踪模块 Controllers/OpenApi/* 当前是如何暴露的。完成的标准是由 Toolkit 负责 UI、路由和共享资源,仅列出具有已生成 specs 的模块,通过 Toolkit 路由提供这些 specs,并让生成过程保持模块特定。
由索引模型根据 Issue 内容生成。
描述
Summary
Refactor OpenAPI integration so Toolkit becomes the single host for the OpenAPI UI, routes, and shared Swagger assets, while generated OpenAPI specs continue to live inside the modules they document.
Why
Current OpenAPI integration mixes shared and module-specific responsibilities.
Today:
- the shared OpenAPI HTML view lives in the project’s
shared/views/openapi - Swagger UI assets are published into a shared public asset directory
- per-module
openapi/docsandopenapi/specroutes are injected into each module - generated OpenAPI specs live inside each module under
resources/openapi/spec.json
This creates an awkward split where a shared UI is accessed through module-local route publication.
Toolkit is already the framework’s developer-facing web UI for features such as:
- database access
- logs
- emails
- module management
That makes Toolkit the better place to host OpenAPI documentation access centrally.
Goal
Make Toolkit the central OpenAPI UI host while preserving module ownership of generated specs.
Proposed Direction
Toolkit should own OpenAPI UI hosting
Toolkit should become the single place that owns:
- OpenAPI pages/views
- OpenAPI routes
- shared Swagger UI assets
OpenAPI should no longer rely on shared non-Toolkit HTML views or per-module docs route injection for UI access.
Generated specs should remain module-owned
Generated specs should continue to live inside each documented module:
modules/{Module}/resources/openapi/spec.json
This keeps OpenAPI output aligned with the module that owns the API.
Toolkit should discover only generated specs
Toolkit should list only modules that already have generated OpenAPI spec files.
Discovery should be based on the presence of:
resources/openapi/spec.json
Toolkit should not try to infer availability only from annotation sources.
Toolkit should serve specs through Toolkit routes
Toolkit should expose module OpenAPI specs through Toolkit-owned routes rather than relying on direct file access or module-local openapi/spec routes.
Generation command should stop owning shared UI concerns
The current module-targeted OpenAPI command should no longer publish shared UI assets or inject module docs routes.
Its responsibility should be reduced to module-specific spec generation.
Because of that narrower responsibility, the command name should be reviewed and likely changed from:
install:openapi
to something more accurate such as:
openapi:generate
A backward-compatible alias can be considered separately if needed.
UX Expectations
- if Toolkit is installed but no module has a generated spec yet, Toolkit should show an empty state rather than a broken page
- users must run the spec generation command for a module before that module appears in Toolkit’s OpenAPI UI
Acceptance Criteria
- Toolkit owns the OpenAPI UI entry point
- Toolkit owns the OpenAPI routes/pages
- Toolkit owns the shared Swagger UI asset usage
- generated specs remain stored inside each module under
resources/openapi/spec.json - Toolkit lists only modules that already have generated spec files
- Toolkit serves module specs through Toolkit routes
- per-module OpenAPI docs route injection is no longer required for the Toolkit-hosted flow
- the module-targeted OpenAPI command is reduced to spec-generation responsibility and its command naming is reviewed accordingly
Notes
Relevant code:
src/Console/Commands/OpenApiCommand.phpsrc/Console/Commands/InstallToolkitCommand.phpsrc/Module/Templates/Toolkit- project
shared/views/openapi/openapi.php - project
public/assets/OpenApiUi - module
resources/openapi/spec.json - module
Controllers/OpenApi/*
This ticket should be treated as the first OpenAPI/Toolkit integration step. It centralizes OpenAPI hosting in Toolkit without changing module ownership of generated specs.
- 主要语言
- PHP
- 星标
- 36
- 派生
- 22
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quantum-php/framework 的其他 Issue
-
routing testing
难度 2/5 1-3 小时 新手友好度 76/100
quantum-php/framework#547 ·
-
view
难度 1/5 1 小时以内 新手友好度 75/100
quantum-php/framework#542 ·
-
enhancement http
难度 5/5 一周以上 新手友好度 35/100
quantum-php/framework#565 · 1 条评论 ·
-
components view
难度 5/5 一周以上 新手友好度 42/100
quantum-php/framework#551 ·
-
Add explicit @version special route token support for API major versioning within a single module未关闭routing
难度 5/5 一周以上 新手友好度 45/100
quantum-php/framework#550 ·
查看 quantum-php/framework 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
Broken paths未关闭
难度 1/5 1 小时以内 新手友好度 88/100
Automattic/custom-metadata#167 ·
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复