Router
Router protocol schemas
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'> | ✅ | |
| handler | string | ✅ | Unique handler identifier |
| summary | string | optional | OpenAPI summary |
| description | string | optional | OpenAPI description |
| public | boolean | ✅ | Is publicly accessible |
| permissions | string[] | optional | Required permissions |
| timeout | integer | optional | Execution timeout in ms |
| rateLimit | string | optional | Rate limit policy name |
RouterConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| basePath | string | ✅ | Global API prefix |
| mounts | { data: string; metadata: string; auth: string; automation: string; … } | ✅ | |
| 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 |