Skip to content

Commit b07c75b

Browse files
akoclaude
andcommitted
docs: document MDL-WIDGET01 and MDL-WIDGET02 in rules + error reference
Users hitting these rule IDs in mxcli check output or LSP diagnostics had nowhere to look them up — the docs site listed the 14 lint rules but not the new check-time widget validations. - \`tools/builtin-rules.md\` gains a new "Check-time Rules" section covering MDL-WIDGET01 (unknown pluggable widget property) and MDL-WIDGET02 (legacy native widget on upgraded project). Lead paragraph clarifies the lint-vs-check rule distinction. - \`appendixes/error-messages.md\` gains cause/solution entries for both error codes under a new "mxcli Check Errors" section, slotted between the Studio Pro errors and the MDL parser errors. Each entry shows the real error format and the recovery steps (Levenshtein hint, refresh catalog, widget init for MDL-WIDGET01; --post-migration workflow for MDL-WIDGET02). Cross-linked: the rules page links to the error-messages entries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5a3af99 commit b07c75b

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

docs-site/src/appendixes/error-messages.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,45 @@ System.ArgumentNullException: Value cannot be null.
6464

6565
**Solution:** Use a qualified name string (e.g., `"Module.Entity.Attribute"`) for the `Attribute` field in ValidationRule BSON, not a binary UUID.
6666

67+
## mxcli Check Errors
68+
69+
These rule IDs appear in `mxcli check` output and in LSP diagnostics in VS Code. They fire before MxBuild runs, so most pluggable-widget mistakes are caught at authoring time.
70+
71+
### MDL-WIDGET01: Unknown pluggable widget property
72+
73+
```
74+
page MyModule.OrderList: widget `cb1` (combobox) has no property
75+
`optionsSourcType` — did you mean `optionsSourceType`? [MDL-WIDGET01]
76+
```
77+
78+
**Cause:** The property key written on a pluggable widget is not declared in the widget's `.def.json` (the extracted schema from its `.mpk`). Usually a typo; sometimes a property that exists in a different widget but not this one.
79+
80+
**Solution:**
81+
1. Compare the key against the widget's known properties — `mxcli describe widget <Name>` lists them.
82+
2. Use the suggested replacement if one is offered (Levenshtein-nearest match).
83+
3. If the property genuinely doesn't exist on this widget version, check that `.mxcli/widgets/` has the latest schema: `mxcli refresh catalog -p app.mpr` re-extracts any `.mpk` whose mtime changed.
84+
4. If the property was just added by a `.mpk` upgrade, make sure `mxcli init` or `widget init` was run after the upgrade.
85+
86+
This rule also fires in the LSP — the property key shows as a red squiggle while you type.
87+
88+
### MDL-WIDGET02: Legacy native widget on upgraded project
89+
90+
```
91+
page MyModule.OrderList: widget `OrdersGrid` uses deprecated native
92+
`Forms$DataGrid` (deprecated from Mendix 11.0.0) — migrate to pluggable
93+
Datagrid 2.x (`DATAGRID` keyword resolves to this on 11.0+) (project is
94+
on 11.9.0) [MDL-WIDGET02]
95+
```
96+
97+
**Cause:** Studio Pro does not auto-migrate native-stack widgets (e.g. `Forms$DataGrid`) to their pluggable replacements during a Mendix major-version upgrade. After upgrading from Mendix 10.x to 11.x, your pages can still contain the native widget unless you opened them and migrated by hand.
98+
99+
**Solution:**
100+
1. Run `mxcli check --post-migration -p app.mpr` to get the full list of pages and widgets to migrate.
101+
2. Open each reported page in Studio Pro and replace the native widget with its pluggable equivalent. For DataGrid, this means using the `DATAGRID` MDL keyword (which resolves to pluggable Datagrid 2.x on Mendix 11.0+) or `pluggablewidget 'com.mendix.widget.web.datagrid.Datagrid'`.
102+
3. Re-run the scan to confirm the page is clean.
103+
104+
The deprecated-widget catalog is hand-maintained in `mdl/executor/keyword_dispatch.go` (`LegacyWidgets`). Open an issue if you spot a native widget that should be on the list.
105+
67106
## mxcli Parser Errors
68107

69108
### Mismatched input

docs-site/src/tools/builtin-rules.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Built-in Rules
22

3-
mxcli ships with 14 built-in lint rules implemented in Go. These rules are fast and always available.
3+
mxcli ships with built-in rules implemented in Go. These rules are fast and always available.
4+
5+
The **lint rules** below run with `mxcli lint`. There is also a separate group of **check-time rules** that run with `mxcli check` — see [Check-time Rules](#check-time-rules-mxcli-check) at the bottom of this page.
46

57
## MDL Rules
68

@@ -50,3 +52,14 @@ System and marketplace modules often trigger false positives. Exclude them:
5052
```bash
5153
mxcli lint -p app.mpr --exclude System --exclude Administration
5254
```
55+
56+
## Check-time Rules (`mxcli check`)
57+
58+
These rules run with `mxcli check` (and the LSP, for real-time diagnostics) rather than `mxcli lint`. They focus on pluggable-widget authoring.
59+
60+
| Rule | Where it fires | Description |
61+
|------|----------------|-------------|
62+
| **MDL-WIDGET01** | `mxcli check` + LSP | Unknown property key on a pluggable widget. The property is not in the widget's `.def.json`. Catches typos like `optionsSourcType` (missing `e`) before MxBuild does. Suggests the nearest known key. |
63+
| **MDL-WIDGET02** | `mxcli check --post-migration` | Legacy native widget found on a project that has a pluggable replacement available. Reports each occurrence with the qualified document name, widget instance name, and the recommended pluggable widget. |
64+
65+
Run `mxcli check --help` for usage. See [Error Messages → MDL-WIDGET01 / MDL-WIDGET02](../appendixes/error-messages.md#mdl-widget01-unknown-pluggable-widget-property) for cause-and-solution detail.

0 commit comments

Comments
 (0)