Skip to content

fix(mdl): document import/export mappings, published REST services and data transformers (mendixlabs/mxcli#1510) - #1533

Merged
ako merged 2 commits into
mainfrom
feature/1510-documentation-for-mappings-rest-javaparams
Oct 21, 2026
Merged

ako merged 2 commits into
mainfrom
feature/1510-documentation-for-mappings-rest-javaparams

Conversation

@ako

@ako ako commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Fixes mendixlabs#1510 (#1392). The maintainer chose option (a): let MDL write the documentation that QUAL002 asks for. Two commits.

Syntax

No new keywords. The existing /** … */ doc comment above a create is now stored, as it already is for JSON structures:

/** Reads an order line from the shop API. */
create [or modify] import mapping M.IMM … | export mapping … | published rest service … | data transformer …

Root causes (commit 1)

  1. The comment was dropped. The four create AST structs had no Documentation field, so the comment was classed as detached (MDL089) and never read.
  2. Existing documentation was erased on rewrite. None of the four executors set the documentation, so create or modify wrote an empty value over it. The data transformer writer wrote a hard-coded "". A PedApp test proves that describe → exec of a Studio Pro-documented mapping deleted its documentation.
  3. QUAL002 could never be satisfied for published REST. The catalog wrote "" for published_rest_services.Documentation, so QUAL002 flagged every service, even ones documented in Studio Pro.

Fix:

  • AST fields and doc-comment reading in the visitors.
  • The executors set the documentation and carry the stored value when no comment is written.
  • model.PublishedRestService and model.DataTransformer gain Documentation, read and written by the backend.
  • Documentation is no longer in the published REST service's unauthored set. PublicDocumentation (the OpenAPI text) is still carried as stored.
  • A shared describe helper, and the catalog now stores the value.

BSON field verified: a top-level Documentation string on ImportMappings$ImportMapping, ExportMappings$ExportMapping, Rest$PublishedRestService and DataTransformers$DataTransformer. The evidence:

  • the generated types;
  • the raw Studio Pro-stored PedApp mappings;
  • mx dump-mpr showing each MDL-written comment as that unit's documentation, on 11.6.6 and 11.15.

Commit 2: MDL089 message

For a doc comment above a create that can't store one, MDL089 used to say "move it above the next create". That would attach the comment to a different element. It now says MDL can't store documentation for that element and suggests a -- comment. Drop, grant, revoke, set and alter keep the old suggestion.

Measured

Fixture Script mx check describe shows docs QUAL002 on the documented elements
11.6.6 bug test, minus the data transformer (11.9+) 0 errors yes none
11.15.0 full bug test 0 errors yes none

Lint control: undocumented copies of the same elements still give 4 QUAL002 findings.

Tests

  • TestIntegrationDocumentsReadDocComment_Issue1510 (visitor).
  • TestIntegrationDocumentation_Issue1510 (PedApp copy): stored key, describe → exec round trip, carry, and /** */ clearing.
  • TestIntegrationDocumentation_StudioProMappingKeepsIt_Issue1510.
  • TestPublishedRestServiceDocumentationReachesCatalog_Issue1510, with an undocumented service as control.
  • TestDocumentation_SurvivesRewrite gets four new cases (-tags integration, against an mx 11.15 project).
  • TestValidateProgram_DetachedDocCommentOnCreate_Issue1510.

Revert check:

  • With the fix reverted, every new test fails with the reported symptom.
  • With only the carry stubbed out, the rewrite and Studio Pro cases fail.

Also in this PR: syntax help (import mapping, export mapping, data transformer, published REST), docs-site reference pages, the json-structures-and-mappings skill, two finding files, and mdl-examples/bug-tests/1510-documentation-for-mappings-rest-javaparams.mdl. make build, make test, make lint, check-findings, check-skill-index and check-skill-mdl pass.

For review

  • Behaviour change: create or modify of a published REST service with a doc comment now overwrites the stored documentation. Before, the stored text was always kept.
  • Not fully verified:
    • The -- fallback for text containing */ has no test.
    • The repo has no Studio Pro-stored published REST service or data transformer unit, so for those two the field is verified through the generated types and Mendix's own reader.

Generated by Claude Code

… transformers (mendixlabs#1510)

lint QUAL002 asks for documentation on import and export mappings,
published REST services and data transformers, and MDL could not write
it: the four create statements had no Documentation field, so the
`/** ... */` doc comment above them was dropped with MDL089 and the
findings were permanent. Two more defects kept them that way:

- every create or modify wrote an empty Documentation over the stored
  text (the executors never set it; the data transformer writer wrote a
  literal ""), so describe -> exec of a Studio Pro-documented mapping or
  transformer deleted its documentation;
- the catalog wrote "" for published_rest_services.Documentation, so
  QUAL002 reported every published REST service, documented or not.

The doc comment is now each statement's documentation, as on a JSON
structure: the visitor reads it with its presence bit, the executors set
it and carry the stored text when no comment is written (#1018), the
modelsdk backend reads and writes the top-level `Documentation` key for
published REST services and data transformers (verified against
modelsdk/gen and against Mendix's own reader with `mx dump-mpr` on 11.6.6
and 11.15), describe prints it back, and the catalog stores it.
PublicDocumentation (the OpenAPI text) keeps being carried as stored.

Java action parameter descriptions were already writable (mendixlabs#1588); the
bug-test script covers them alongside.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
… create (mendixlabs#1510)

A doc comment above a create that stores no documentation was warned
with "Move the doc comment directly above `create json structure ...`,
after the `create or modify published rest service ...`" -- moving text
written for one element onto a different one. The next-statement
suggestion is right when a drop, grant, revoke, set or alter stands
between a comment and its create (#877), but a create is itself
the element the comment describes.

For a create, MDL089 now says MDL cannot store documentation for that
element and suggests a `--` comment; the move suggestion stays for the
other statements. The check-syntax skill says the same (and no longer
lists `create module`, which stores documentation since #1314).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
@ako
ako merged commit 97d23bc into main Oct 21, 2026
44 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QUAL002 asks for documentation on document types MDL cannot document (MDL089)

2 participants