Router schema — API Protocol reference
Router schemas of the ObjectStack API Protocol: ConflictResolutionStrategy and 4 more — each property with its type, default and a TypeScript example.
Source: packages/spec/src/api/router.zod.ts
TypeScript Usage
import { ConflictResolutionStrategy, HttpMethod, RouteCategory, RouteDefinitionSchema, RouterConfigSchema } from '@objectstack/spec/api';
import type { ConflictResolutionStrategy, HttpMethod, RouteCategory, RouteDefinition, RouterConfig } from '@objectstack/spec/api';
// Validate data
const result = ConflictResolutionStrategy.parse(data);ConflictResolutionStrategy
Allowed Values
errorpriorityfirst-winslast-wins
HttpMethod
HTTP method — the full routing vocabulary (api/* endpoints, router and REST-server routes). The narrower HttpMethodSubset is what view data sources may request.
Allowed Values
GETPOSTPUTDELETEPATCHHEADOPTIONS
RouteCategory
Allowed Values
systemapiauthstaticwebhookplugin
RouteDefinition
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| method | Enum<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'> | ✅ | HTTP method — the full routing vocabulary (api/* endpoints, router and REST-server routes). The narrower HttpMethodSubset is what view data sources may request. |
| path | string | ✅ | URL Path pattern |
| category | Enum<'system' | 'api' | 'auth' | 'static' | 'webhook' | 'plugin'> | optional (default: "api") | |
| handler | string | ✅ | Unique handler identifier |
| summary | string | optional | OpenAPI summary |
| description | string | optional | OpenAPI description |
| public | boolean | optional (default: false) | Is publicly accessible |
| permissions | string[] | optional | Required permissions |
| timeoutMs | integer | optional | Execution timeout in ms |
| timeout | never | optional | [REMOVED] RouteDefinition.timeout was renamed to timeoutMs in @objectstack/spec 17 — the unit of a duration-shaped number lives in the key name, not only in the describe prose. Rename the key to timeoutMs; the value (milliseconds) is unchanged. |
| rateLimit | string | optional | Rate limit policy name |
RouterConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| basePath | string | optional (default: "/api") | Global API prefix |
| mounts | { data?: string; metadata?: string; auth?: string; automation?: string; … } | optional (has default) | |
| cors | { enabled?: boolean; origins?: string | string[]; methods?: Enum<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'>[]; credentials?: boolean; … } | optional | |
| staticMounts | { path: string; directory: string; cacheControl?: string }[] | optional |
Nested Shape: RouterConfig.mounts
| Property | Type | Required | Description |
|---|---|---|---|
| data | string | optional (default: "/data") | Data Protocol (CRUD) |
| metadata | string | optional (default: "/meta") | Metadata Protocol (Schemas) |
| auth | string | optional (default: "/auth") | Auth Protocol |
| automation | string | optional (default: "/automation") | Automation Protocol |
| storage | string | optional (default: "/storage") | Storage Protocol |
| analytics | string | optional (default: "/analytics") | Analytics Protocol |
| ui | string | optional (default: "/ui") | UI Metadata Protocol (Views, Layouts) |
| realtime | string | optional (default: "/realtime") | Realtime/WebSocket Protocol |
| notifications | string | optional (default: "/notifications") | Notification Protocol |
| ai | string | optional (default: "/ai") | AI Engine Protocol (NLQ, Chat, Suggest) |
| i18n | string | optional (default: "/i18n") | Internationalization Protocol |
| packages | string | optional (default: "/packages") | Package Management Protocol |
Nested Shape: RouterConfig.cors
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | optional (default: true) | Enable CORS |
| origins | string | string[] | optional (default: "*") | Allowed origins (* for all) |
| methods | Enum<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'>[] | optional | Allowed HTTP methods |
| credentials | boolean | optional (default: false) | Allow credentials (cookies, authorization headers) |
| maxAge | integer | optional | Preflight cache duration in seconds (unit per CORS Access-Control-Max-Age (WHATWG Fetch)) |
Nested Shape: RouterConfig.staticMounts[number]
| Property | Type | Required | Description |
|---|---|---|---|
| path | string | ✅ | URL path to serve from |
| directory | string | ✅ | Physical directory to serve |
| cacheControl | string | optional | Cache-Control header value |
Protocol
Protocol schemas of the ObjectStack API Protocol: AiAgentCapabilities and 136 more — each property with its type, default and a TypeScript example.
Versioning
Defines how API versions are negotiated between client and server. Supports multiple versioning strategies and deprecation lifecycle management.