Summary
During a full PoC build using only mxcli MDL, we encountered multiple issues that `mxcli check` (or `mxcli exec`) either silently accepts or gives unhelpful error messages. These issues only surface later via `mx check` with cryptic CE codes. mxcli should catch them at MDL-compile time and give clear hints.
Catalog of Issues
1. RETRIEVE variable name ignored — uses entity name instead (#38 related)
MDL input:
```mdl
RETRIEVE $AgentForCSV FROM AgentCommons.Agent WHERE Title = 'X' LIMIT 1;
```
Expected: Variable named `AgentForCSV` in model.
Actual: Mendix model uses `Agent` (entity name), causing CE0111 "Duplicate variable name 'Agent'" when there's another RETRIEVE of the same entity type.
Hint mxcli should give: `RETRIEVE variable names may be overridden by entity name in the Mendix model. Use unique entity types or restructure to avoid duplicates.`
2. Inherited attribute in CREATE/CHANGE not resolved (#new)
MDL input:
```mdl
$File = CREATE MyModule.MyFileDoc (Name = 'test.csv');
-- or
CHANGE $File (Name = 'test.csv');
```
Where `MyFileDoc EXTENDS System.FileDocument` and `Name` is inherited.
mx check: CE1613 "The selected attribute 'MyModule.MyFileDoc.Name' no longer exists."
Fix that works: `CHANGE $File (System.FileDocument.Name = 'test.csv');`
Hint mxcli should give: `Attribute 'Name' is inherited from System.FileDocument. Use 'System.FileDocument.Name' for inherited attributes.`
3. Reserved keywords as parameter names not quoted
MDL input:
```mdl
CALL MICROFLOW GenAICommons.Request_AddMessage(
Request = $Req, ...
);
```
mxcli error: `mismatched input 'Request' expecting {...}`
Fix: `"Request" = $Req`
Hint mxcli should give: `'Request' is a reserved keyword. Use "Request" (double-quoted) for parameter names that match reserved words.`
4. SHOW_PAGE parameter uses `=` but should use `:`
MDL input:
```mdl
SHOW PAGE Module.Page(Param = $var);
```
mxcli error: `mismatched input '=' expecting ':'`
Fix: `SHOW PAGE Module.Page(Param: $var);`
Hint mxcli should give: `SHOW PAGE parameters use ':' not '='. Syntax: SHOW PAGE Module.Page(Param: $value)`
5. $currentObject invalid in DATAGRID CONTROLBAR context (#41)
See issue #41. mxcli should reject or auto-resolve to widget name variable.
6. Association navigation missing target entity + extra spaces (#38)
See issue #38. Generates `$Var / Assoc / Attr` instead of `$Var/Assoc/Entity/Attr`.
7. Enum value format differs between XPath and expression contexts (#39)
See issue #39. mxcli should auto-detect context.
Proposal
Add a `mxcli check` or `mxcli lint` pass that validates generated expressions against known Mendix rules BEFORE writing to the .mpr file, similar to how `mx check` works but with actionable MDL-specific hints.
Summary
During a full PoC build using only mxcli MDL, we encountered multiple issues that `mxcli check` (or `mxcli exec`) either silently accepts or gives unhelpful error messages. These issues only surface later via `mx check` with cryptic CE codes. mxcli should catch them at MDL-compile time and give clear hints.
Catalog of Issues
1. RETRIEVE variable name ignored — uses entity name instead (#38 related)
MDL input:
```mdl
RETRIEVE $AgentForCSV FROM AgentCommons.Agent WHERE Title = 'X' LIMIT 1;
```
Expected: Variable named `AgentForCSV` in model.
Actual: Mendix model uses `Agent` (entity name), causing CE0111 "Duplicate variable name 'Agent'" when there's another RETRIEVE of the same entity type.
Hint mxcli should give: `RETRIEVE variable names may be overridden by entity name in the Mendix model. Use unique entity types or restructure to avoid duplicates.`
2. Inherited attribute in CREATE/CHANGE not resolved (#new)
MDL input:
```mdl
$File = CREATE MyModule.MyFileDoc (Name = 'test.csv');
-- or
CHANGE $File (Name = 'test.csv');
```
Where `MyFileDoc EXTENDS System.FileDocument` and `Name` is inherited.
mx check: CE1613 "The selected attribute 'MyModule.MyFileDoc.Name' no longer exists."
Fix that works: `CHANGE $File (System.FileDocument.Name = 'test.csv');`
Hint mxcli should give: `Attribute 'Name' is inherited from System.FileDocument. Use 'System.FileDocument.Name' for inherited attributes.`
3. Reserved keywords as parameter names not quoted
MDL input:
```mdl
CALL MICROFLOW GenAICommons.Request_AddMessage(
Request = $Req, ...
);
```
mxcli error: `mismatched input 'Request' expecting {...}`
Fix: `"Request" = $Req`
Hint mxcli should give: `'Request' is a reserved keyword. Use "Request" (double-quoted) for parameter names that match reserved words.`
4. SHOW_PAGE parameter uses `=` but should use `:`
MDL input:
```mdl
SHOW PAGE Module.Page(Param = $var);
```
mxcli error: `mismatched input '=' expecting ':'`
Fix: `SHOW PAGE Module.Page(Param: $var);`
Hint mxcli should give: `SHOW PAGE parameters use ':' not '='. Syntax: SHOW PAGE Module.Page(Param: $value)`
5. $currentObject invalid in DATAGRID CONTROLBAR context (#41)
See issue #41. mxcli should reject or auto-resolve to widget name variable.
6. Association navigation missing target entity + extra spaces (#38)
See issue #38. Generates `$Var / Assoc / Attr` instead of `$Var/Assoc/Entity/Attr`.
7. Enum value format differs between XPath and expression contexts (#39)
See issue #39. mxcli should auto-detect context.
Proposal
Add a `mxcli check` or `mxcli lint` pass that validates generated expressions against known Mendix rules BEFORE writing to the .mpr file, similar to how `mx check` works but with actionable MDL-specific hints.