feat(core): serve a read-only OpenAPI reference page at /docs - #396
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Core now serves a read-only Swagger UI at
GET /docsthat renders the three generated contracts, and the documents themselves atGET /docs/{openapi,core.openapi,runtime.openapi}.yaml.contracts/agents-api/openapi.goembeds the committedopenapi.yaml,core.openapi.yamlandruntime.openapi.yaml, so Core serves exactly whatmake openapigenerated; there is no second copy.services/core/internal/api/openapi_docs.goregisters the two routes without authentication. Only the three embedded files are served; anything else under/docs/is 404.swagger-ui-dist@5.18.2from unpkg with SRI hashes. It is read-only: no operation can be submitted (supportedSubmitMethods: []), the Authorize controls are removed so it never collects a credential, andvalidatorUrl: nullkeeps the browser from contacting the Swagger validator.scripts/build-core.shadds the embedded files to Core's source set.docs/api/index.mdand its Chinese translation describe the page. The reverse proxy does not route/docsto Core, so it is opened on Core's own address.Compatibility
Additive only.
/docsand/docs/*previously returned 404 on Core; no existing route, contract or configuration changes.Checks
go test ./services/core/internal/api/ ./services/core/cmd/server ./contracts/agents-api/... -count=1scripts/build-core.shmake check-docswebsite/tests/translations.test.mjs: translation coverage and freshness pass; the inline-literal check needsvitepressand is left to CI.Made with Cursor
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.