Conversation
…its mappings and its commit option (#571) create published rest service wrote only the path's {name} placeholders as operation parameters, each a String: a query or body microflow parameter failed mx check with CE0350, an Integer {id} with CE6539. import mapping, export mapping and commit parsed and were thrown away. - Parameters are derived from the microflow as Studio Pro derives them (path name -> Path, object/list -> Body, HttpRequest/HttpResponse -> none, else Query), each with the microflow parameter's type, merged over the stored parameters so a header / renamed / described one survives. - Mappings and commit go AST -> model -> BSON and back; describe prints them and notes parameters MDL cannot state. An unknown commit option is refused by exec and check (MDL-REST03). - create or modify carries the restated operation's summary, documentation and object handling; the service rewrite carries the stored keys MDL cannot state (authentication, CORS, documentation). List markers as Studio Pro writes them. TestApp's Services.OrdersRestApi leaves the round-trip allowlist. Fixes mendixlabs#1206 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Closes #571
Fixes mendixlabs#1206
What was wrong
create published rest servicewrote only the path's{name}placeholders as operation parameters, each as a String.import mapping,export mappingandcommiton an operation parsed, then were thrown away: the writer hard-coded them to""/""/Yes. The reader never read parameters, mappings or commit, sodescribecould not print them, andalter(which rewrites every operation) lost them too. The service writer also wrote constants forAuthenticationTypes,AuthenticationMicroflow,CorsConfiguration,DocumentationandPublicDocumentation.The worst case was executing
describeoutput of a Studio Pro service. On TestApp'sServices.OrdersRestApiit reportedModified, and a 0-error app went to 5mx checkerrors:What Studio Pro stores (measured)
Services.OrdersRestApi, Studio Pro 11.14:Rest$RestOperationParameterholdsName,ParameterType(Path/Body),MicroflowParameter(Module.Microflow.Param),Description, andTypeas the microflow parameter's ownDataTypes$*(IntegerType; ObjectType withEntity);ImportMapping/ExportMappingare qualified names;Resources3,Operations2, operationParameters3, the service's emptyParameters[3],AuthenticationTypesa marker-1 string list.ped_get_schemaover the MCP tunnel:commit: 'Yes' | 'YesWithoutEvents' | 'No', default No;objectHandlingBackup: Create | Ignore | Error;parameterType: Path | Query | Body | Header | Form;LongType, so Long is written as IntegerType, as the microflow writer does.Fix
Parameters are derived from the microflow, the way Studio Pro does it:
System.HttpRequest/HttpResponse→ none;Each parameter gets the microflow parameter's type. Derivation is merged over the stored parameters, matched on the bound microflow parameter. A header parameter, a renamed one or a described one set in Studio Pro keeps its name, kind and description, while its type follows the microflow. When the microflow does not exist yet, the operation keeps today's String path parameters and exec prints a warning.
Mappings and commit go AST → model → BSON → reader.
describeprintsimport mapping X export mapping Y, andcommit Zwhen Z is notYes. The visitor now builds quoted mapping names as qualified names instead ofGetText().Refused instead of dropped:
commit Maybe) is refused by exec, andcheckreports it as MDL-REST03;describecomment, andcreate or modify/alteron that project keep them.Rewrites keep what MDL cannot state:
create or modifycarries the restated operation's Summary, Documentation and ObjectHandlingBackup (matched by resource, method and path);UpdatePublishedRestServicecarries the stored service-level keys above (keepStoredTopLevel, next to the ExportLevel carry).List markers are now the ones Studio Pro writes.
Design choices
Yes. Studio Pro's default isNo, but changing it would rewrite every operation mxcli has already created, and the language is frozen.describeprintscommitwhenever the stored value is notYes, so the round trip is exact either way.Test plan
mdl/executor/cmd_published_rest_params_test.go:commit Noas the control;create or modifykeeping a stored Header parameter, description, summary, documentation and object handling;alter add resourcederiving the new operation and leaving the old ones alone;describeprinting bindings and notes, with its output re-parsing to the stored bindings.mdl/backend/modelsdk/published_rest_write_test.go:TestCreatePublishedRestService_WritesParametersAndBindings: write and read back every parameter field, the bindings, and the String path fallback;TestWithStoredTopLevel, with an unlisted-key control.ExportMapping: Services.OrdersExportMapping ->,Commit: No -> Yes);AuthenticationTypes: 3 -> 1 items);Resources[0]: 3 -> 2).published rest service Services.OrdersRestApientry is struck from the TestApp allowlist, so the allowlist shrinks.go test -tags integration ./mdl/roundtrip -run 'TestTestAppRoundTrip$|TestPedAppRoundTrip$'passes.mdl-examples/bug-tests/571-published-rest-parameters-and-mappings.mdl(the create published rest service writes only path parameters: query and body parameters fail mx check (CE0350, CE6539) mendixlabs/mxcli#1206 repro plus an import/export-mapped operation), then a service on TestApp's real mappings, thendescribe → execofServices.OrdersRestApi:mdl 1):describe → execofRestQ.Orders,Services.MappedApiandServices.OrdersRestApireportsUnchanged, twice, and no file under the project changes. A repeatedalter … set Versionwrites nothing.go test -tags integration ./mdl/executor -run TestMxCheck_DoctypeScripts/22: mx check passes with 0 errors.go test ./mdl/executor ./mdl/backend/modelsdk ./mdl/visitor ./model ./cmd/mxcli ./mdl/conformance,make lint,make check-mdl,make check-conformanceandmake check-findingsall pass.Finding appended to
.claude/skills/fix-issue/findings/mdl-executor.jsonl. Docs:mxcli syntax rest.published,docs-site/src/examples/rest-integration.md(it no longer says'{id}'requires$id: String), CHANGELOG.🤖 Generated with Claude Code