docs: rename aliases to virtual models and regenerate API reference#427
Conversation
Aliases and access overrides were unified into "virtual models" (ADR-0008, #423/#424). Bring the user-facing docs and the generated API reference in line, and move the feature page to its new URL. - Rewrite the feature page as Virtual Models (redirects/aliases plus access policies); move /features/aliases -> /features/virtual-models with a docs.json redirect and rename the screenshot alongside it. - Update related terminology in user-path, audio, anthropic-messages, responses, and azure docs. - Regenerate docs/openapi.json and cmd/gomodel/docs/docs.go: /admin/model-overrides -> /admin/virtual-models, and modeloverrides.* -> virtualmodels.* schemas. - Unbreak swagger generation: add swaggertype tags to the goccy/go-json json.RawMessage fields in internal/anthropicapi (matching the internal/core convention) and point tools/openapi-postprocess.mjs at the new virtual-models admin schemas and endpoint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR updates generated OpenAPI artifacts, docs, tooling, and release E2E scenarios to replace admin model-overrides and alias wording with virtual-models. It also changes Anthropic Swagger metadata and OpenAPI post-processing rules for object-shaped fields and new request bounds. ChangesVirtual model contract and docs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Migrate the release e2e alias scenarios to the unified virtual-models admin endpoint and its request/response shape (source instead of name, provider-qualified target_model, redirect kind/targets assertions), following the aliases -> virtual models change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Confidence Score: 4/5The generated API reference rename is largely consistent, with one response-code documentation gap around virtual-model store failures.
docs/openapi.json
What T-Rex did
Reviews (1): Last reviewed commit: "test(e2e): use /admin/virtual-models in ..." | Re-trigger Greptile |
| "500": { | ||
| "description": "Internal Server Error", | ||
| "content": { | ||
| "application/json": { | ||
| "schema": { | ||
| "$ref": "#/components/schemas/core.GatewayError" | ||
| } | ||
| } | ||
| } | ||
| }, |
There was a problem hiding this comment.
When a virtual-model store write fails, the admin handler returns 502, but the new PUT /admin/virtual-models schema only documents 500 and 503. Clients generated from this reference can treat a reachable store-failure response as undocumented; the same 502 response should also be documented for the delete path.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tools/openapi-postprocess.mjs`:
- Around line 435-442: The schema fixes added in the OpenAPI postprocess step
are only affecting the OpenAPI artifact, so mirror the same required-field and
array-bound updates in the Swagger 2 generation path. Update the schema-building
logic that feeds cmd/gomodel/docs/docs.go, specifically the pieces behind
admin.upsertModelPricingOverrideRequest,
admin.deleteModelPricingOverrideRequest, admin.upsertVirtualModelRequest, and
core.ResponsesConversationRef, so selector, pricing, source, and id are marked
required there too and admin.upsertVirtualModelRequest.user_paths gets the same
maxItems cap. Use the same helpers or equivalent schema mutations in the Swagger
2 pipeline as in applyBudgetKeySchemaConstraints, ensureRequiredProperty, and
applyStringArrayPropertyBounds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9ba6450f-2308-4c65-8d57-1c6762b96dd7
⛔ Files ignored due to path filters (1)
docs/features/virtual-models.pngis excluded by!**/*.png
📒 Files selected for processing (13)
cmd/gomodel/docs/docs.godocs/advanced/anthropic-messages-api.mdxdocs/advanced/audio-api.mdxdocs/advanced/responses-api.mdxdocs/docs.jsondocs/features/aliases.mdxdocs/features/user-path.mdxdocs/features/virtual-models.mdxdocs/openapi.jsondocs/providers/azure.mdxinternal/anthropicapi/types.gotests/e2e/release-e2e-scenarios.mdtools/openapi-postprocess.mjs
💤 Files with no reviewable changes (1)
- docs/features/aliases.mdx
…2 spec Address PR review feedback: - /admin/virtual-models PUT and DELETE return 502 (StatusBadGateway) on store write failures via virtualModelWriteError, but the annotations omitted it (PUT documented 500, which the handler never returns). Document 502 on both, matching the model-pricing-overrides handler. - Mirror the virtual-models required-field and array bounds into swagger-postprocess.mjs so the embedded Swagger 2 spec (cmd/gomodel/docs/docs.go) matches the published OpenAPI: source required on upsert/delete, user_paths maxItems, and the /admin/virtual-models listing maxItems cap. Regenerated docs/openapi.json and cmd/gomodel/docs/docs.go. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/admin/handler_virtualmodels.go`:
- Line 60: The Swagger annotation for UpsertVirtualModel is missing the
reachable 204 No Content success path, so update the OpenAPI comments on the
UpsertVirtualModel handler to document that response alongside the existing 200
success. Make sure the response annotations around findVirtualModelView and the
successful write path include the 204 outcome when the virtual model is created
or upserted but no content is returned.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: c351f6d4-2ba8-4fad-8312-15bb30e0b6fb
📒 Files selected for processing (4)
cmd/gomodel/docs/docs.godocs/openapi.jsoninternal/admin/handler_virtualmodels.gotools/swagger-postprocess.mjs
| // @Failure 400 {object} core.GatewayError | ||
| // @Failure 401 {object} core.GatewayError | ||
| // @Failure 500 {object} core.GatewayError | ||
| // @Failure 502 {object} core.GatewayError |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Document the 204 success path for UpsertVirtualModel.
This annotation block still only advertises a 200 success, but the handler returns 204 No Content on Lines 85-88 when findVirtualModelView misses after a successful write. That leaves the generated Swagger/OpenAPI contract incomplete for a reachable response path.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/admin/handler_virtualmodels.go` at line 60, The Swagger annotation
for UpsertVirtualModel is missing the reachable 204 No Content success path, so
update the OpenAPI comments on the UpsertVirtualModel handler to document that
response alongside the existing 200 success. Make sure the response annotations
around findVirtualModelView and the successful write path include the 204
outcome when the virtual model is created or upserted but no content is
returned.
What & why
Aliases and access overrides were unified into virtual models (ADR-0008, #423/#424). This brings the user-facing docs and the generated API reference in line with that change and moves the feature page to its new URL.
User-visible impact
/features/virtual-models(redirect from/features/aliasesadded indocs.json, so existing links keep working). The screenshot moves with it.user_path).GET/PUT/DELETE /admin/virtual-modelsinstead of the removed/admin/model-overrides.Changes
user-path,audio-api,anthropic-messages-api,responses-api, andazure.docs/openapi.json+cmd/gomodel/docs/docs.go—/admin/model-overrides→/admin/virtual-models,modeloverrides.*→virtualmodels.*schemas.make swaggerwas failing onmain. Two pre-existing causes fixed:internal/anthropicapiusesgoccy/go-json, which swag can't special-case like the stdlib, so itsjson.RawMessagefields failed to resolve. Addedswaggertype:"object"tags (matching the existinginternal/coreconvention — swag-only, no runtime effect).tools/openapi-postprocess.mjsstill referenced the removedmodel-overridesadmin schemas; pointed it at the new virtual-models schemas/endpoint.Notes
make swaggernow succeeds and the regenerated artifacts are included.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Bug Fixes
Tests