Validate Your Flow Configurations
The Validate Your Flow Configurations feature in Lunar.dev allows users to verify their flow settings before deploying them into production. This validation step is crucial for catching any configuration errors, such as missing parameters, improper connections, or unsupported fields, ensuring that your flows will run smoothly when live.
ποΈ 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.
ποΈ Terminal Flow Validator
By using validate_flows command before each deployment, you maintain robust, error-free flow configurations, reducing the risk of production disruptions. This essential validation step provides confidence and reliability, ensuring that your API consumption management operates seamlessly.
What the Validation Doesβ
- Loads and Parses Configurations: Reads all YAML files in your specified flow, quota, and path directories.
- Checks Syntax and Structure: Ensures that YAML syntax is correct, with no missing or invalid keys.
- Validates Connections and Parameters: Confirms that all required parameters, such as filters and processors, are defined.
- Reports Errors or Success: Provides feedback for any detected issues or, if all is well, confirms that flows are validated successfully.
Key Benefitsβ
- Avoid Production Issues: Catch and resolve configuration errors before they affect live traffic.
- Troubleshoot Quickly: Receive detailed feedback on configuration issues, saving time in debugging.
- Ensure Compliance: Confirm that flows adhere to Lunar.devβs structure, avoiding unsupported setups or risky configurations.
Example Use Cases and Responsesβ
Example 1: Missing Required Fields
If a flow configuration file lacks a required field, the validate_flows
command will return an error message like this:
π Failed to validate flows: connection from is required in file path: /flows/my_flow.yaml
This message helps you locate the file and missing field, allowing you to add the required field and re-run validation.
Example 2: Invalid YAML Syntax
In cases where the YAML syntax is incorrect (e.g., indentation issues or missing colons), you might see:
π Failed to validate flows: YAML syntax error in file /flows/rate_limit.yaml at line 10: unexpected indentation
After fixing the YAML syntax, re-run the validation command.
Example 3: Unsupported Parameters in Flow
If your flow configuration includes unsupported parameters or incorrect types, the validation will fail with an error message like:
π Failed to validate flows: unsupported parameter "rate_limit_type" found in /flows/rate_limit.yaml
This error indicates that rate_limit_type
is not recognized. Adjust the parameter according to the Lunar.dev documentation, and re-run validation.
Example 4: Successful Validation
When all configurations pass validation, youβll see a success message:
β
Successfully validated flows
This confirmation means your configurations are ready for deployment, and you can confidently load them into production.