Endpoint
Endpoint protocol schemas
API Mapping Schema
Transform input/output data.
Source: packages/spec/src/api/endpoint.zod.ts
TypeScript Usage
import { ApiEndpoint, ApiMapping } from '@objectstack/spec/api';
import type { ApiEndpoint, ApiMapping } from '@objectstack/spec/api';
// Validate data
const result = ApiEndpoint.parse(data);ApiEndpoint
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| name | string | ✅ | Unique endpoint ID |
| path | string | ✅ | URL Path (e.g. /api/v1/customers) |
| method | Enum<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'> | ✅ | HTTP Method |
| summary | string | optional | |
| description | string | optional | |
| type | Enum<'flow' | 'script' | 'object_operation' | 'proxy'> | ✅ | Implementation type |
| target | string | ✅ | Target Flow ID, Script Name, or Proxy URL |
| objectParams | Object | optional | For object_operation type |
| inputMapping | Object[] | optional | Map Request Body to Internal Params |
| outputMapping | Object[] | optional | Map Internal Result to Response Body |
| authRequired | boolean | ✅ | Require authentication |
| rateLimit | Object | optional | Rate limiting policy |
| cacheTtl | number | optional | Response cache TTL in seconds |
ApiMapping
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| source | string | ✅ | Source field/path |
| target | string | ✅ | Target field/path |
| transform | string | optional | Transformation function name |