Validate Syntax
AI-generatedOverview
This node operation validates the syntax of Mermaid diagram code. It checks if the provided Mermaid code starts with a recognized diagram type and returns whether the syntax appears valid or invalid. It can optionally provide detailed validation information, including the detected diagram type or error details. This operation is useful for users who want to verify Mermaid diagram code before generating diagrams, ensuring the code is syntactically correct and supported.
Use Case Examples
- Validating Mermaid code snippets in automation workflows to prevent errors in diagram generation.
- Checking Mermaid syntax in user inputs before processing or rendering diagrams.
Properties
| Name | Meaning |
|---|---|
| Mermaid Code | The Mermaid diagram code to validate. |
| Detailed Output | Whether to return detailed validation information. |
Output
JSON
valid- Boolean indicating if the Mermaid syntax is valid.message- Summary message about the validation result.detailsdiagramType- The detected Mermaid diagram type if detailed output is enabled and syntax is valid.code- Snippet of the Mermaid code if syntax is invalid and detailed output is enabled.supportedTypes- List of supported Mermaid diagram types if syntax is invalid and detailed output is enabled.
error- Error message if an exception occurred during validation.
Troubleshooting
- Ensure the Mermaid code starts with a supported diagram type such as 'graph', 'flowchart', 'sequenceDiagram', etc., as the validation checks the code prefix.
- If the node returns 'Mermaid syntax is invalid - unrecognized diagram type', verify the diagram type spelling and supported types.
- If an error occurs during validation, check the Mermaid code for syntax errors or unexpected characters.