Skip to content

Commit ce1442f

Browse files
akoclaude
andcommitted
fix: published REST operation parameter schema for mx check 11.9.0
The published REST service writer was emitting parameter BSON with the wrong field structure, causing four mx check errors: - CE0845: 'Please enter a type for parameter id' — DataType was a bare string 'String' instead of a structured DataTypes\$StringType object - CE6538: 'Parameter id is not passed to a microflow parameter' — the MicroflowParameter field was missing entirely - CE0350 / CE0352: cascading errors from the missing MicroflowParameter The Rest\$RestOperationParameter schema actually requires: - Type: structured DataTypes\$StringType object (not 'DataType' string) - ParameterType: 'Path' (vs Query/Header/Body) - MicroflowParameter: qualified name 'Module.Microflow.paramName' By convention, the path parameter name must match a microflow parameter name so they can be wired automatically. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4000f8b commit ce1442f

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

sdk/mpr/writer_rest.go

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func (w *Writer) serializePublishedRestService(svc *model.PublishedRestService)
356356
"ExportMapping": "",
357357
"ImportMapping": "",
358358
"ObjectHandlingBackup": "Create",
359-
"Parameters": serializePublishedRestParams(op.Path, op.Parameters),
359+
"Parameters": serializePublishedRestParams(op.Path, op.Microflow, op.Parameters),
360360
}
361361
ops = append(ops, opDoc)
362362
}
@@ -394,16 +394,34 @@ func (w *Writer) serializePublishedRestService(svc *model.PublishedRestService)
394394
// serializePublishedRestParams builds the Parameters array for a published REST operation.
395395
// It auto-extracts path parameters from {paramName} placeholders in the path string,
396396
// then appends any explicitly declared parameters.
397-
func serializePublishedRestParams(path string, _ []string) bson.A {
397+
//
398+
// Each parameter must include:
399+
// - Type: a structured DataTypes$StringType object (not a bare string)
400+
// - ParameterType: "Path" (vs Query/Header/Body)
401+
// - MicroflowParameter: qualified name of the matching microflow parameter,
402+
// so Mendix wires the path value to the handler. Without this, mx check
403+
// reports CE6538 "Parameter is not passed to a microflow parameter" and
404+
// CE0350 "Microflow has a parameter that is not a parameter of the operation".
405+
func serializePublishedRestParams(path string, microflowQN string, _ []string) bson.A {
398406
params := bson.A{int32(2)}
399407
// Extract {paramName} from path
400408
for _, name := range extractPathParams(path) {
409+
// MicroflowParameter format: "Module.Microflow.parameterName"
410+
mfParam := ""
411+
if microflowQN != "" {
412+
mfParam = microflowQN + "." + name
413+
}
401414
params = append(params, bson.M{
402-
"$ID": idToBsonBinary(generateUUID()),
403-
"$Type": "Rest$RestOperationParameter",
404-
"Name": name,
405-
"DataType": "String",
406-
"Description": "",
415+
"$ID": idToBsonBinary(generateUUID()),
416+
"$Type": "Rest$RestOperationParameter",
417+
"Name": name,
418+
"Type": bson.M{
419+
"$ID": idToBsonBinary(generateUUID()),
420+
"$Type": "DataTypes$StringType",
421+
},
422+
"ParameterType": "Path",
423+
"MicroflowParameter": mfParam,
424+
"Description": "",
407425
})
408426
}
409427
return params

0 commit comments

Comments
 (0)