Expression Library API
Built-in and custom expression templates used in pipeline operator logic stages. Custom expressions are tenant-scoped.
| Field | Value |
|---|---|
| Port | 50033 |
| Base Path | /api/v1 |
| Framework | Spring Boot 3.2.0, Java 21 |
| OpenAPI | 3.0.1 |
| Spec | Expression_LIbrary.json |
| Swagger UI | /swagger-ui.html |
| Database | PostgreSQL (daitics) |
Authentication
| Config | Value |
|---|---|
| Method | OAuth2 JWT (Keycloak) |
| Multi-tenancy | tenant_id from JWT — custom expressions scoped per tenant |
| CORS | localhost:3000, localhost:8080, *.daitics.com |
| Public endpoints | /actuator/health, /actuator/info, /v3/api-docs/**, /swagger-ui/** |
System Expressions (Read-Only)
Built-in expressions available to all tenants.
| Method | Path | Description | Query Params |
|---|---|---|---|
| GET | /api/v1/expressions | List system expressions | category, operatorType, search, tags[] |
| GET | /api/v1/expressions/{id} | Get by integer ID | — |
| GET | /api/v1/expressions/by-expression-id/{expressionId} | Get by string ID (e.g., CONCAT) | — |
ExpressionDTO
{
"id": 1,
"expressionId": "CONCAT",
"name": "CONCAT",
"category": "STRING",
"operatorTypes": ["TRANSFORM", "FILTER"],
"description": "Concatenates multiple strings...",
"syntax": "CONCAT(str1, str2, ...strN, separator)",
"example": "CONCAT(firstName, \" \", lastName) -> \"John Doe\"",
"parameters": [ ... ],
"returnType": "STRING",
"tags": ["string", "text", "concatenation"],
"isActive": true
}
Custom Expressions (Tenant-Scoped CRUD)
| Method | Path | Description | Status Codes |
|---|---|---|---|
| GET | /api/v1/expressions/custom | List tenant's custom expressions | 200 |
| POST | /api/v1/expressions/custom | Create custom expression | 201, 400, 409 |
| GET | /api/v1/expressions/custom/{id} | Get by UUID | 200, 404 |
| PUT | /api/v1/expressions/custom/{id} | Update (version increments on body change) | 200, 400, 404, 409 |
| DELETE | /api/v1/expressions/custom/{id} | Soft delete | 204, 404 |
| POST | /api/v1/expressions/custom/{id}/use | Increment usage count | 200 |
CreateCustomExpressionRequest
| Field | Type | Required | Validation |
|---|---|---|---|
expressionId | string | Yes | 3–100 chars, ^[a-z0-9_]+$ |
name | string | Yes | 3–100 chars, starts with letter |
description | string | No | Max 1000 chars |
category | string | Yes | Max 50 chars |
operatorTypes | string[] | No | — |
parameters | object (JSONB) | Yes | — |
body | string | Yes | 1–5000 chars |
returnType | string | Yes | See return types below |
tags | string[] | No | — |
isTemplate | boolean | No | Default false |
Return Types: STRING INTEGER DECIMAL BOOLEAN DATE TIMESTAMP ARRAY JSON ANY
Response Envelope
{
"success": true,
"data": { ... },
"error": {
"code": "string",
"message": "string",
"details": { ... }
},
"timestamp": "2025-11-11T10:30:00"
}
Error Codes
| Code | HTTP | Meaning |
|---|---|---|
RESOURCE_NOT_FOUND | 404 | Expression not found |
VALIDATION_ERROR | 400 | Input validation failed |
DATA_INTEGRITY_VIOLATION | 409 | Duplicate expression_id |
INTERNAL_SERVER_ERROR | 500 | Unexpected error |
Database Tables
| Table | Key | Scope | Indexes |
|---|---|---|---|
expressions_library | id (SERIAL), unique expression_id | System-wide | 11 (B-tree + GIN for arrays/JSONB/FTS) |
custom_expressions | id (UUID) | Per-tenant (tenant_id) | 11 (B-tree + GIN) |
Health & Actuator
| Path | Auth | Description |
|---|---|---|
/actuator/health | Public | DB, disk, liveness, readiness |
/actuator/info | Public | Service info |
/actuator/metrics | Auth required | Prometheus-style metrics |
Frontend Integration
| File | Purpose |
|---|---|
services/expression-library/expression-library.service.ts | Expression fetching & evaluation |
services/expression-library/useExpressions.ts | React Query hook |
types/expression-library-api.types.ts | TypeScript types |