diff --git a/CHANGELOG.md b/CHANGELOG.md index 0298a06..70157c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.0.22 + +- Replace default Swagger UI docs pages with Scalar API Reference for both RPC and legacy HTTP routers. +- Preserve auth prefix behavior in docs by applying guard prefixes to outgoing request headers. + +## 0.0.21 + +- Treat `encoding/json.RawMessage` as arbitrary JSON in generated schemas and clients instead of byte arrays. + ## 0.0.20 - Remove the unused `httpapi` lightweight JS client generator path. diff --git a/VERSION b/VERSION index cd23180..818944f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.17 +0.0.22 diff --git a/docs/agents/overview.md b/docs/agents/overview.md index 5a5e987..8d6f774 100644 --- a/docs/agents/overview.md +++ b/docs/agents/overview.md @@ -15,6 +15,7 @@ Virtuous is designed to be deterministic for agents. Keep project layout and han ```text You are implementing a Virtuous RPC API. +- Target Virtuous version: read `VERSION` in the repo and pin it in the output (current: `0.0.21`). - Create router.go with rpc.NewRouter(rpc.WithPrefix("/rpc")). - Put handlers in package folders (states, users, admin). - Use func(ctx, req) (Resp, int). @@ -26,6 +27,7 @@ You are implementing a Virtuous RPC API. ```text Migrate Swaggo routes to Virtuous using the canonical guide at docs/tutorials/migrate-swaggo.md. +- Target Virtuous version: read `VERSION` in the repo and pin it in the output (current: `0.0.21`). - For Swaggo migrations, use httpapi first. - Use rpc only for explicit phase-2 moves. - Move field docs to doc struct tags. diff --git a/docs/overview.md b/docs/overview.md index 3abf1b3..de26cce 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -131,6 +131,7 @@ deps/ ```text You are implementing a Virtuous RPC API. +- Target Virtuous version: read `VERSION` in the repo and pin it in the output (current: `0.0.21`). - Create router.go with rpc.NewRouter(rpc.WithPrefix("/rpc")). - Put handlers in package folders (states, users, admin). - Use func(ctx, req) (Resp, int). @@ -142,6 +143,7 @@ You are implementing a Virtuous RPC API. ```text Use the canonical Swaggo migration prompt in docs/tutorials/migrate-swaggo.md. +- Target Virtuous version: read `VERSION` in the repo and pin it in the output (current: `0.0.21`). - Default to httpapi for Swaggo routes. - Use rpc only for phase-2 moves. - Validate against the migration Definition of Done in that guide. @@ -171,6 +173,7 @@ Agent prompt (porting legacy handlers): ```text Port legacy handlers into Virtuous. +- Target Virtuous version: read `VERSION` in the repo and pin it in the output (current: `0.0.21`). - For each handler, decide: RPC (new) or httpapi (legacy). - For legacy: wrap http.HandlerFunc with httpapi.WrapFunc and register a method-prefixed route. - For new: create an RPC handler and register with router.HandleRPC. diff --git a/docs/tutorials/migrate-swaggo.md b/docs/tutorials/migrate-swaggo.md index d23565f..7a43f56 100644 --- a/docs/tutorials/migrate-swaggo.md +++ b/docs/tutorials/migrate-swaggo.md @@ -175,6 +175,7 @@ Use this prompt for migration automation: You are migrating a Go API from Swaggo annotations to Virtuous. Goal: +- Pin the target Virtuous version from `VERSION` and report it explicitly (current: `0.0.21`). - Replace annotation-driven docs with Virtuous runtime docs/clients. - For Swaggo migrations, migrate routes to httpapi first. - Use RPC as an explicit phase-2 optimization after compatibility is preserved. @@ -191,9 +192,10 @@ Rules: Deliverables: 1) Code changes for migrated routes. -2) A migration completion checklist against the Definition of Done in docs/tutorials/migrate-swaggo.md. -3) List of routes intentionally deferred to phase-2 RPC and why. -4) Any routes blocked by feature mismatch, with concrete gap notes. +2) Reported target Virtuous version from `VERSION`. +3) A migration completion checklist against the Definition of Done in docs/tutorials/migrate-swaggo.md. +4) List of routes intentionally deferred to phase-2 RPC and why. +5) Any routes blocked by feature mismatch, with concrete gap notes. ``` ## Known gaps vs Swaggo diff --git a/httpapi/docs.go b/httpapi/docs.go index ac660a7..2ae264c 100644 --- a/httpapi/docs.go +++ b/httpapi/docs.go @@ -10,28 +10,65 @@ import ( "github.com/swetjen/virtuous/internal/textutil" ) -// DefaultDocsHTML returns a Swagger UI HTML page for the provided OpenAPI path. +// DefaultDocsHTML returns a Scalar API Reference HTML page for the provided OpenAPI path. func DefaultDocsHTML(openAPIPath string) string { return fmt.Sprintf(`
+