A standalone HTTP server for the Common Architecture Language Model (CALM) validation functionality.
The calm-server executable provides HTTP endpoints for CALM architecture validation.
- Bundled CALM Schemas - All CALM schemas (release and draft) are bundled with the executable
- Health Check Endpoint (
GET /health) - Status endpoint for monitoring - Validation Endpoint (
POST /calm/validate) - Validate CALM architectures against bundled schemas, or against an optional pattern supplied in the request
# Basic usage (uses bundled schemas by default)
calm-server
# With custom port
calm-server --port 8080
# With verbose logging
calm-server --port 3000 --verbose
# Or provide a custom schema directory
calm-server -s /path/to/calm/schemas --port 3000Usage: calm-server [options]
Options:
-V, --version output the version number
--port <port> Port to run the server on (default: "3000")
--host <host> Host to bind the server to (default: "127.0.0.1")
-s, --schema-directory <path> Path to the directory containing the meta schemas
(default: bundled schemas in dist/calm)
-v, --verbose Enable verbose logging (default: false)
-c, --calm-hub-url <url> URL to CALMHub instance
--rate-limit-window <ms> Rate limit window in milliseconds (default: 900000 = 15 minutes)
--rate-limit-max <requests> Max requests per IP within the rate limit window (default: 100)
--allowed-remote-hosts <hosts> Comma-separated trusted remote hosts allowed for $ref resolution
in user-supplied patterns (default: calm.finos.org).
Also configurable via CALM_ALLOWED_REMOTE_HOSTS.
-h, --help display help for command
- Default Host is Localhost: By default, the server binds to
127.0.0.1for security - No Built-in Authentication: This server has no authentication or authorization controls
- Network Exposure: When binding to non-localhost addresses, a security warning is logged. Only expose to the network in trusted environments
- User-Supplied Pattern
$refs: When apatternis supplied in the/calm/validaterequest, the server compiles it. To prevent arbitrary local-file reads and SSRF,$refs in the supplied pattern are restricted to local fragment references (e.g.#/defs/node) and absolutehttps(s)URLs. Absolute filesystem paths (/etc/...,C:\...), relative paths, andfile://URLs are rejected with a400. Remote hosts are further restricted to the--allowed-remote-hostsallowlist (defaultcalm.finos.org) - Architecture
$schema(no pattern supplied): when no pattern is provided, the$schemafield is resolved through the document loader to locate the schema, so it must be an absolutehttp(s)URL. Local filesystem paths (absolute or relative) andfile://URLs are rejected with a400to prevent arbitrary local-file reads. (When a pattern is supplied,$schemais only matched against the pattern's$idand is not resolved).
Check if the server is running:
curl http://localhost:3000/healthResponse:
{
"status": "OK"
}Validate a CALM architecture document:
curl -X POST http://localhost:3000/calm/validate \
-H "Content-Type: application/json" \
-d '{
"architecture": "{\"$schema\":\"https://calm.finos.org/release/1.2/meta/calm.json\",\"nodes\":[]}"
}'Validate a CALM architecture against a runtime-supplied pattern by including an optional pattern field in the same /calm/validate request:
curl -X POST http://localhost:3000/calm/validate \
-H "Content-Type: application/json" \
-d @calm-server/test_fixtures/validation_route/valid_instantiation_with_pattern.jsonRequest requirements (otherwise the endpoint responds with
400):
- Both
architectureandpatternare sent as JSON-encoded strings inside the request body, and each must parse to a JSON object.- The architecture's
$schemafield must exactly match the pattern's$idfield. If they differ, the request is rejected before validation runs.$refs in the supplied pattern must be local fragment references (#/...) or absolutehttp(s)URLs to allowed hosts (see Security Considerations).
Response (success):
{
"jsonSchemaValidationOutputs":[],
"spectralSchemaValidationOutputs":[],
"hasErrors":false,
"hasWarnings":false
}Response (validation errors):
{
"jsonSchemaValidationOutputs":[],
"spectralSchemaValidationOutputs":[...],
"hasErrors":true,
"hasWarnings":false
}# From repository root
npm run build:calm-server
# Or from calm-server directory
cd calm-server
npm run build# From repository root
npm run test:calm-server
# Or from calm-server directory
cd calm-server
npm test
# With coverage
npm test -- --coverage# From calm-server directory
npm run lint
npm run lint-fixApache-2.0