fix(rest): derive published REST operation parameters from the microflow - #1207
Open
tgolembiewski wants to merge 1 commit into
Open
tgolembiewski wants to merge 1 commit into
tgolembiewski wants to merge 1 commit into
Conversation
create published rest service wrote only the path's {name} placeholders as
operation parameters, each as a String. Any other microflow parameter failed
mx check with CE0350, and an {id} bound to an Integer failed CE6539. MDL has
no syntax for operation parameters, so a query parameter, a body or an upload
could not be built; a generated app parsed HttpRequest/Uri by hand instead.
Studio Pro derives them from the microflow: a parameter named in the path is
a path parameter, an object or a list is the body, System.HttpRequest and
HttpResponse are left out, and anything else is a query parameter. create
and alter now do the same before the service is written, each parameter with
the microflow parameter's own type. When the microflow does not exist yet,
the operation keeps its path parameters and exec says so.
Measured on Mendix 11.12.1 with
mdl-examples/bug-tests/published-rest-operation-parameters.mdl: 4 mx check
errors on v0.24.0 and on main, 0 with this change. At runtime
GET .../status?orderNumber=ORD%2F2026%2F0012&count=3 answers ORD/2026/0012:3,
and re-executing describe output leaves the service unchanged.
Refs mendixlabs#1206
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor Issues
What Looks Good
RecommendationApprove the PR. It correctly implements the fix for issue #1206 by deriving published REST operation parameters from microflow parameters matching Studio Pro's behavior. The changes are minimal, focused, well-tested, and properly documented. The solution follows the project's architectural patterns and maintains backward compatibility while resolving the mx check failures described in the issue. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
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 #1206
What
create published rest servicewrote only the path's{name}placeholders as operation parameters, each as a String. Every other microflow parameter failedmx check:{id}bound to an Integer with CE6539.MDL has no syntax for operation parameters, so these operations could not be built at all.
Studio Pro derives an operation's parameters from its microflow (Published REST Operation). This PR does the same when the service is written:
System.HttpRequest,System.HttpResponseNo new syntax.
createandalterboth derive the parameters, sincealterwrites every operation again and the reader does not read parameters back.If the microflow does not exist yet, the operation keeps today's path-only parameters, and
execprints a warning that names the microflow and the CE0350 to expect.Measured on a blank Mendix 11.12.1 app with
mdl-examples/bug-tests/published-rest-operation-parameters.mdl:mx checkAt runtime,
GET rest/orders/v1/orders/status?orderNumber=ORD%2F2026%2F0012&count=3answersORD/2026/0012:3, so the runtime binds the query parameters, slashes included.Changes
mdl/executor/cmd_published_rest.go:deriveOperationParameters/operationParametersOfmap the microflow's parameters with the rule above;createandalterwrite the service;model/types.go:PublishedRestOperation.OperationParametersandPublishedRestOperationParameter(name, kind, data type, entity or enumeration);PathParameterNames(), moved from the writer'sextractPathParamsso the executor and the writer read the path the same way.mdl/backend/modelsdk/published_rest_write.go:mxcli syntax rest.publishedsays where operation parameters come from;docs-site/src/examples/rest-integration.md, which also drops "{id}requires$id: String".mdl-examples/bug-tests/published-rest-operation-parameters.mdl: the repro.CHANGELOG.md([Unreleased]/ Fixed), and one line in.claude/skills/fix-issue/findings/mdl-executor.jsonl.Tests
New tests:
TestDeriveOperationParameters_AsStudioPro: Path with an Integer type, Query including an enumeration, Body for an object and a list,HttpRequest/HttpResponseleft out;TestDeriveOperationParameters_WarnsWhenTheMicroflowIsMissing;TestCreateAndAlterPublishedRestService_DeriveParameters: both statements hand the backend derived parameters, andalterderives them for the operations it did not touch;TestCreatePublishedRestService_WritesDerivedParameters: the storedRest$RestOperationParameterBSON (kind, type,MicroflowParameter) and the String path fallback.Each part of the fix was stubbed out in turn, and each time a test failed (8 of 8):
create;alter;HttpRequest;No regression on the repo's example:
mdl-examples/doctype-tests/22-published-rest-service-examples.mdlgives 0mx checkerrors before and after.Round trip: re-executing
describe published rest serviceoutput reports every serviceUnchangedand leaves every.mxunitbyte-identical, for the repro and for the doctype example.The whole of
push-test.ymlran locally on macOS, all green:make test;mx11.12.1;mdbook build docs-site(0.5.2) passes too.Not in this PR
Each is noted in #1206:
IMPORT MAPPING,EXPORT MAPPINGandCOMMITon an operation are parsed into the AST but never written. A separate fix.AuthenticationTypesis always written empty.