docs(proposal): spec authorable message definitions - #371
Merged
Conversation
A mapping binds to one of four schema sources and MDL can create exactly one. Measured across all 327 import/export mappings in the nine demo apps: JSON structure 250 (76.5%), message definition 74 (22.6%), XML schema 3 (0.9%), imported web service 0. So a project built entirely through MDL can express three-quarters of the mappings a real app has. Message definitions are the one remaining source that is both worth doing and doable: unlike an XML schema or a WSDL, the document holds nothing external — it is a selection over the domain model. The spec is measurement-first, over all 36 collections / 56 definitions / 4,686 elements. Almost every property is a constant or is derived; the author chooses only the collection name, each definition's name, its root entity, the members, and an optional rename. Two findings shape the syntax: MaxOccurs is NOT a function of the association's type — all 927 resolvable ones are Reference, yet 526 are MaxOccurs=1 and 401 are -1. It tracks the DIRECTION of traversal, with zero counter-examples: holder is the FROM entity → 1 (496), holder is the TO entity → -1 (401). Getting that backwards exposes a list as a single object with no build error behind it, so the statement names the target entity (`Assoc/Module.Entity`, the shape mappings already use) and direction is explicit rather than inferred. Studio Pro pluralises a repeating element's ExposedName (Reference→References, Factory→Factories, Parts→Parts) while keeping ExposedItemName at the singular — 461/461. ExposedItemName is therefore free; the plural is not, and the proposal recommends NOT implementing English inflection, defaulting to OriginalName with `as` to override. Same conclusion as #272's item naming, and the cost of it is stated rather than buried. Closes nothing; opens the design for review. Refs #272 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec only — no code. Opens the design for review before anything is built.
Why this one
A mapping binds to one of four schema sources, and MDL can create exactly one.
Measured across all 327 import/export mappings in the nine demo apps:
Message definitions are the one remaining source that is both worth doing and
doable. An XML schema holds an imported
.xsdand a WSDL holds its schemaentries inline — authoring either means a foreign parser. A message definition
holds nothing external: it is a selection over the domain model.
The measurement
All 36 collections / 56 definitions / 4,686 elements. Four element types,
every property present on every instance, no optional keys.
Almost everything is a constant or derived —
MinOccurs=0,Nillable=true,MaxLength/FractionDigits/TotalDigits=-1, all four text fields empty, in4,686 of 4,686. The author chooses only the collection name, each definition's
name, its root entity, the members, and an optional rename.
Two findings that shape the syntax
MaxOccursis not a function of the association's type. All 927 resolvableassociations are
Reference, yet 526 carry1and 401 carry-1. It tracks thedirection of traversal, with zero counter-examples:
MaxOccurs1-1Get it backwards and the definition exposes a list as a single object — with no
build error behind it. So the statement names the target entity
(
Assoc/Module.Entity, the shape import and export mappings already use) anddirection becomes explicit in the source rather than inferred.
Studio Pro pluralises a repeating element's
ExposedNamewhile keepingExposedItemNameat the singular — 461/461.Reference→References(386),Factory→Factories(71),Parts→Parts(4).ExposedItemNameis free; the plural is not. The proposal recommends notimplementing English inflection — default to
OriginalName,as 'Orders'tooverride — the same conclusion as #272's array-item naming and for the same
reason. The cost is stated rather than buried: without
as, an mxcli-writtendefinition differs from a Studio-Pro one on every repeating element. Requiring
asinstead is flagged as the reviewable alternative.Proposed syntax
Plus
DROP,DESCRIBE(re-executable) andSHOW— there is no listing todayat all.
OR MODIFYpreserves the UUID, because mappings reference the collectionby qualified name.
What a reviewer should push on
ason a repeating element? It removes the silent divergence fromStudio Pro at the cost of friction.
refuse rather than guess. Is that the right call, or should it block?
layouts?
Method note
The census was read through
mprbson.units(), not by grepping the extractedtree. Grep only sees units that are files — MPR v2 only — and an MPR v1
project keeps them in the SQLite
Unit.Contentsblob. That is exactly how anearlier XML-schema count came back as zero when the answer was three (#259
follow-up, #363).
🤖 Generated with Claude Code