@@ -13,6 +13,14 @@ import (
1313 "github.com/mendixlabs/mxcli/sdk/mpr"
1414)
1515
16+ // isBuiltinModuleEntity returns true for modules whose entities are defined
17+ // internally by the Mendix runtime and are therefore not present in the MPR's
18+ // domain models. These types are serialized using the qualified name reference
19+ // ("System.Workflow", "System.User", etc.) and resolved at runtime.
20+ func isBuiltinModuleEntity (moduleName string ) bool {
21+ return moduleName == "System"
22+ }
23+
1624// execCreateMicroflow handles CREATE MICROFLOW statements.
1725func (e * Executor ) execCreateMicroflow (s * ast.CreateMicroflowStmt ) error {
1826 if e .writer == nil {
@@ -105,8 +113,10 @@ func (e *Executor) execCreateMicroflow(s *ast.CreateMicroflowStmt) error {
105113
106114 // Validate and add parameters
107115 for _ , p := range s .Parameters {
108- // Validate entity references for List and Entity types
109- if p .Type .EntityRef != nil {
116+ // Validate entity references for List and Entity types.
117+ // Built-in modules (e.g. System) are not stored in the MPR domain models;
118+ // their types are serialized by qualified name and resolved at runtime.
119+ if p .Type .EntityRef != nil && ! isBuiltinModuleEntity (p .Type .EntityRef .Module ) {
110120 entityID := entityResolver (* p .Type .EntityRef )
111121 if entityID == "" {
112122 return fmt .Errorf ("entity '%s.%s' not found for parameter '%s'" ,
@@ -133,8 +143,10 @@ func (e *Executor) execCreateMicroflow(s *ast.CreateMicroflowStmt) error {
133143
134144 // Validate and set return type
135145 if s .ReturnType != nil {
136- // Validate entity references for return type
137- if s .ReturnType .Type .EntityRef != nil {
146+ // Validate entity references for return type.
147+ // Built-in modules (e.g. System) are not stored in the MPR domain models;
148+ // their types are serialized by qualified name and resolved at runtime.
149+ if s .ReturnType .Type .EntityRef != nil && ! isBuiltinModuleEntity (s .ReturnType .Type .EntityRef .Module ) {
138150 entityID := entityResolver (* s .ReturnType .Type .EntityRef )
139151 if entityID == "" {
140152 return fmt .Errorf ("entity '%s.%s' not found for return type" ,
0 commit comments