validate_code
Validate X++ or XML code for syntax errors, best-practice violations, and missing references. Catch hallucinations before compiling.
Instructions
Static validator for generated X++/XML (paste the text). Choose a mode:
• syntax → offline best-practice/BP validator (no xppbp.exe). Structured violations {rule, severity, line, excerpt, fix}. Covers select, CoC, BP and table-XML rules mined from standard models.
• references → semantic reference resolver (index-only): verifies every type, field, method (incl. arity), enum, label and intrinsic (tableStr/fieldStr/…) EXISTS in the indexed codebase — catches hallucinated symbols before the compiler. codeType="xml-table" checks XML refs instead: EDT/enum/relation/extends/label.
Call mode="both" AFTER generating, BEFORE writes; fix errors in the same turn. Write tools run references internally when GROUNDING_ENFORCE=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | X++ source code or XML metadata to validate. Paste the full generated text. | |
| mode | Yes | both = run the two checks in ONE call (preferred); syntax = BP/best-practice rules only; references = symbol resolution only. | |
| context | No | Optional: owning class/table name, used in diagnostic messages. | |
| codeType | No | [syntax] "xpp" for X++ source (default), "xml-table" for AxTable XML, "xml-any" for other XML. | xpp |