Standalone Flow Validator
The standalone Flow Validator provides independent flow validation capabilities outside of the Lunar Gateway. This tool operates as a stateless REST web server and is designed for use by both the UI and end-users.
Key Features
- Modes of Operation:
- Validates flows from a path-based folder input.
- Accepts Base64-encoded YAML files as input.
- Request Handling: Supports POST requests to the
/validate-flows
endpoint, allowing configuration of parameters like ID, folder path, and flows. - Output: Returns a validation result with a success status and detailed messages.
note
- The Flow Validator is stateless and does not store any data persistently.
- For best practices, validate flows before deploying them into a live environment to avoid runtime errors.
Run Commands
docker pull lunarapi/flows-validator
docker run --rm -d -p 8083:8083 --name flow-validator lunarapi/flows-validator:latest
- The default port is 8083.
Custom Port Configuration
To run the validator on a custom port (e.g., 9090):
docker run --rm -d -e LUNAR_VALIDATOR_PORT=9090 -p 9090:9090 --name flow-validator lunarapi/flows-validator:latest
Mounting a Host Directory
If using folder-based validation, you need to mount the directory containing flow configuration files:
docker run --rm -d -p 8083:8083 -v /path/on/host:/path/in/container --name flow-validator lunarapi/flows-validator:latest
Replace /path/on/host
with your host directory and /path/in/container
with the desired container directory.
API Overview
Endpoint
POST /validate-flows
Input
The validate-flows
endpoint accepts a JSON payload structured as follows:
{
"id": "string", // Optional setup ID; defaults if empty
"folder_path": "string", // Path to the folder with flow files
"gateway_config": "string", // Base64-encoded Gateway configuration
"flows": ["string"], // Base64-encoded YAML flows
"path_params": "string", // Path parameters (optional)
"quotas": ["string"] // Quotas configuration (optional)
}
Output
The API responds with a JSON object containing the validation results:
{
"success": true, // Boolean indicating validation success
"message": "string" // Descriptive validation result message
}
Example Usage
Request:
curl -X POST http://localhost:8083/validate-flows \
-H "Content-Type: application/json" \
-d '{
"id": "example",
"folder_path": "/path/in/container",
"flows": ["base64_encoded_yaml_1", "base64_encoded_yaml_2"]
}'
Response:
{
"success": true,
"message": "All flows validated successfully."
}