docs(website): align guides with router behavior
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
11 files changed
+63
-30
No files matched your search
@@ -15,14 +15,16 @@ const spec = app.openapi({ title: 'My API', version: '1.0.0' });
|
||||
|
||||
It reads the routes and handler signatures and produces, for each route:
|
||||
|
||||
- the **path**, templated — `/users/:id` → `/users/{id}`, catch-all `:path*` → `{path}`;
|
||||
- the **method**;
|
||||
- the **path**, templated — `/users/:id` → `/users/{id}`, constrained `:id(\d+)` → `{id}`, catch-all `:path*` → `{path}`;
|
||||
- the **explicitly declared method**, including `@Head` and `@Options`;
|
||||
- **parameters** — path params from the pattern, plus query/header params from the handler's `@query` / `@headers` / `@header` decorators;
|
||||
- a **request body** entry for routes that read `@body()`;
|
||||
- the systematic **responses** — `200`, a `422` when any argument is schema-validated, and `500`.
|
||||
|
||||
WebSocket routes are omitted (they aren't request/response).
|
||||
|
||||
A constrained path parameter remains a string parameter and carries its route expression as `schema.pattern`. Only declared operations appear: implicit HEAD and automatic OPTIONS fallbacks are runtime conveniences and are not invented in the OpenAPI document.
|
||||
|
||||
## Serve it — `devOpenapi`
|
||||
|
||||
Opt in to a `GET /__openapi__` endpoint that returns the document as JSON — point Swagger UI, Redoc, or a codegen client at it:
|
||||
|
||||
Reference in new issue
Block a user