validate_code
Validates generated X++/XML code for syntax and best-practice violations, and verifies that all referenced types, fields, and methods exist to prevent compilation errors before writing changes.
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 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 | syntax = BP/best-practice rules; references = symbol resolution against the index. Defaults to syntax. | |
| 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 |