Skip to content

Commit 9b76c07

Browse files
akoclaude
andcommitted
fix: repair lowercase convention regressions in widget builder and MDL examples
The initial lowercase conversion had several bugs: - Widget builder used strings.ToUpper(w.Type) with lowercase case values, causing "unsupported widget type: layoutgrid/datagrid" at runtime. Fixed all ToUpper → ToLower in page builder, widget engine, and validation code. - MDL example files had qualified identifiers after '.' incorrectly lowercased (System.Image → System.image, System.User → System.User, etc.) because the conversion script did not protect all identifier positions. Restored correct Mendix entity/role name casing. - Business event attribute types (Long, String) stored as raw parser text were now lowercase. Added canonical casing map in dataTypeSimpleName() so the BSON always receives "Long", "String", etc. regardless of MDL input casing. - publish/subscribe switch and objectType switches used ToUpper against lowercase case values. Fixed to ToLower throughout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 00b80f3 commit 9b76c07

15 files changed

Lines changed: 53 additions & 44 deletions

mdl-examples/doctype-tests/01-domain-model-examples.mdl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ create persistent entity DmTest.Attachment extends System.FileDocument (
16921692
* plus adds metadata for product catalog display.
16931693
*/
16941694
@position(2300, 200)
1695-
create persistent entity DmTest.ProductPhoto extends System.image (
1695+
create persistent entity DmTest.ProductPhoto extends System.Image (
16961696
/** Photo caption for display */
16971697
PhotoCaption: string(200),
16981698
/** Display sort order */
@@ -1784,7 +1784,7 @@ create persistent entity DmTest.InternalDocument extends System.FileDocument;
17841784
* Both keywords are supported; EXTENDS is preferred for new code.
17851785
*/
17861786
@position(2300, 600)
1787-
create persistent entity DmTest.ProfilePhoto generalization System.image (
1787+
create persistent entity DmTest.ProfilePhoto generalization System.Image (
17881788
/** Whether this photo has been approved by admin */
17891789
IsApproved: boolean default false
17901790
);

mdl-examples/doctype-tests/06-rest-client-examples.mdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ begin
793793
-- $latestHttpResponse is a system variable (System.HttpResponse) that is
794794
-- automatically populated after SEND REST REQUEST. Check its Content
795795
-- attribute to determine if the call returned data.
796-
if $latestHttpResponse/content != empty then
796+
if $latestHttpResponse/Content != empty then
797797
set $success = true;
798798
log info node 'RestTest' 'ACT_TestHeaders: headers echoed';
799799
else

mdl-examples/doctype-tests/08-security-examples.mdl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ describe user role 'Administrator';
191191
/**
192192
* Create a simple module role without description.
193193
*/
194-
create module role SecTest.user;
194+
create module role SecTest.User;
195195
/
196196

197197
-- Describe a specific module role (shows DDL + which user roles include it)
198-
describe module role SecTest.user;
198+
describe module role SecTest.User;
199199

200200
-- ============================================================================
201201
-- Level 2.2: Module Role with Description
@@ -235,7 +235,7 @@ create module role SecTest.Viewer description 'Read-only access for viewing data
235235
/**
236236
* Allow the User role to execute the customer creation microflow.
237237
*/
238-
grant execute on microflow SecTest.ACT_Customer_Create to SecTest.user;
238+
grant execute on microflow SecTest.ACT_Customer_Create to SecTest.User;
239239
/
240240

241241
-- Verify the grant
@@ -249,7 +249,7 @@ show access on microflow SecTest.ACT_Customer_Create;
249249
/**
250250
* Allow both User and Administrator roles to process orders.
251251
*/
252-
grant execute on microflow SecTest.ACT_Order_Process to SecTest.user, SecTest.Administrator;
252+
grant execute on microflow SecTest.ACT_Order_Process to SecTest.User, SecTest.Administrator;
253253
/
254254

255255
-- ============================================================================
@@ -269,7 +269,7 @@ grant execute on microflow SecTest.ACT_Customer_Delete to SecTest.Administrator;
269269
/**
270270
* Remove User's ability to process orders (admin-only now).
271271
*/
272-
revoke execute on microflow SecTest.ACT_Order_Process from SecTest.user;
272+
revoke execute on microflow SecTest.ACT_Order_Process from SecTest.User;
273273
/
274274

275275
-- Verify the revoke
@@ -290,7 +290,7 @@ revoke execute on microflow SecTest.ACT_Customer_Delete from SecTest.Administrat
290290
/**
291291
* Granting a role that already has access is a no-op (safe to repeat).
292292
*/
293-
grant execute on microflow SecTest.ACT_Customer_Create to SecTest.user;
293+
grant execute on microflow SecTest.ACT_Customer_Create to SecTest.User;
294294
/
295295

296296

@@ -308,7 +308,7 @@ grant execute on microflow SecTest.ACT_Customer_Create to SecTest.user;
308308
/**
309309
* Allow users to view the customer overview page.
310310
*/
311-
grant view on page SecTest.Customer_Overview to SecTest.user;
311+
grant view on page SecTest.Customer_Overview to SecTest.User;
312312
/
313313

314314
-- Verify
@@ -322,7 +322,7 @@ show access on page SecTest.Customer_Overview;
322322
/**
323323
* Allow both users and administrators to view orders.
324324
*/
325-
grant view on page SecTest.Order_Overview to SecTest.user, SecTest.Administrator;
325+
grant view on page SecTest.Order_Overview to SecTest.User, SecTest.Administrator;
326326
/
327327

328328
-- ============================================================================
@@ -332,7 +332,7 @@ grant view on page SecTest.Order_Overview to SecTest.user, SecTest.Administrator
332332
/**
333333
* Remove User's view access on order overview (admin-only now).
334334
*/
335-
revoke view on page SecTest.Order_Overview from SecTest.user;
335+
revoke view on page SecTest.Order_Overview from SecTest.User;
336336
/
337337

338338
-- Verify - should only show Administrator
@@ -374,7 +374,7 @@ grant SecTest.Viewer on SecTest.Customer (read *);
374374
/**
375375
* Grant read access to specific attributes, write to a subset.
376376
*/
377-
grant SecTest.user on SecTest.Customer (read (Name, Email), write (Email));
377+
grant SecTest.User on SecTest.Customer (read (Name, Email), write (Email));
378378
/
379379

380380
-- ============================================================================
@@ -384,7 +384,7 @@ grant SecTest.user on SecTest.Customer (read (Name, Email), write (Email));
384384
/**
385385
* Grant access only to active customers using an XPath constraint.
386386
*/
387-
grant SecTest.user on SecTest.Order (read *, write *) where '[Status = ''Open'']';
387+
grant SecTest.User on SecTest.Order (read *, write *) where '[Status = ''Open'']';
388388
/
389389

390390
-- Verify entity access
@@ -398,7 +398,7 @@ show access on SecTest.Customer;
398398
/**
399399
* GRANT is additive: adding Notes access preserves existing Name and Email.
400400
*/
401-
grant SecTest.user on SecTest.Customer (read (Notes));
401+
grant SecTest.User on SecTest.Customer (read (Notes));
402402
/
403403

404404
-- ============================================================================
@@ -409,13 +409,13 @@ grant SecTest.user on SecTest.Customer (read (Notes));
409409
* Remove read access on a specific attribute (Notes).
410410
* Other permissions are preserved.
411411
*/
412-
revoke SecTest.user on SecTest.Customer (read (Notes));
412+
revoke SecTest.User on SecTest.Customer (read (Notes));
413413
/
414414

415415
/**
416416
* Downgrade write to read-only on Email.
417417
*/
418-
revoke SecTest.user on SecTest.Customer (write (Email));
418+
revoke SecTest.User on SecTest.Customer (write (Email));
419419
/
420420

421421
-- ============================================================================
@@ -446,7 +446,7 @@ show access on SecTest.Customer;
446446
/**
447447
* Create a user role and assign a single module role.
448448
*/
449-
create or modify user role RegularUser (System.user, SecTest.user);
449+
create or modify user role RegularUser (System.User, SecTest.User);
450450
/
451451

452452
-- ============================================================================
@@ -456,7 +456,7 @@ create or modify user role RegularUser (System.user, SecTest.user);
456456
/**
457457
* A user role can include roles from multiple modules.
458458
*/
459-
create or modify user role PowerUser (System.user, SecTest.user, SecTest.Administrator);
459+
create or modify user role PowerUser (System.User, SecTest.User, SecTest.Administrator);
460460
/
461461

462462
-- ============================================================================
@@ -607,7 +607,7 @@ create module role SecTest.Manager description 'Can manage customers and orders'
607607
* Step 2: Grant microflow access based on roles.
608608
* Users can create customers, managers and admins can do everything.
609609
*/
610-
grant execute on microflow SecTest.ACT_Customer_Create to SecTest.user, SecTest.Manager;
610+
grant execute on microflow SecTest.ACT_Customer_Create to SecTest.User, SecTest.Manager;
611611
grant execute on microflow SecTest.ACT_Customer_Delete to SecTest.Manager, SecTest.Administrator;
612612
grant execute on microflow SecTest.ACT_Order_Process to SecTest.Manager, SecTest.Administrator;
613613
/
@@ -616,7 +616,7 @@ grant execute on microflow SecTest.ACT_Order_Process to SecTest.Manager, SecTest
616616
* Step 3: Grant page access based on roles.
617617
* All roles can see customers, only managers+ can see orders.
618618
*/
619-
grant view on page SecTest.Customer_Overview to SecTest.user, SecTest.Manager, SecTest.Administrator;
619+
grant view on page SecTest.Customer_Overview to SecTest.User, SecTest.Manager, SecTest.Administrator;
620620
grant view on page SecTest.Order_Overview to SecTest.Manager, SecTest.Administrator;
621621
/
622622

@@ -648,8 +648,8 @@ show access on page SecTest.Order_Overview;
648648
-- When a module has partial access rules (not all entities covered by all
649649
-- roles), MxBuild reports CE0066 regardless of security level.
650650
revoke SecTest.Administrator on SecTest.Customer;
651-
revoke SecTest.user on SecTest.Customer;
652-
revoke SecTest.user on SecTest.Order;
651+
revoke SecTest.User on SecTest.Customer;
652+
revoke SecTest.User on SecTest.Order;
653653
revoke SecTest.Manager on SecTest.Customer;
654654

655655

mdl-examples/doctype-tests/alter-workflow.mdl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ end;
6565

6666
-- Targeting microflow: (System.Workflow, context) -> List of System.User
6767
create microflow WFTest.ACT_TargetUsers (
68-
$workflow: System.workflow,
68+
$workflow: System.Workflow,
6969
$context: WFTest.OrderContext
7070
)
71-
returns list of System.user as $users
71+
returns list of System.User as $users
7272
begin
7373
@position(200,200)
74-
retrieve $users from System.user;
74+
retrieve $users from System.User;
7575
@position(400,200) return $users;
7676
end;
7777
/
@@ -109,7 +109,7 @@ create page WFTest.AlternateTaskPage (
109109
create page WFTest.OverviewPage (
110110
title: 'Workflow Overview',
111111
layout: Atlas_Core.Atlas_Default,
112-
params: { $workflow: System.workflow }
112+
params: { $workflow: System.Workflow }
113113
) {
114114
layoutgrid g1 {
115115
row r1 {

mdl-examples/doctype-tests/workflow-microflow-actions.mdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ end workflow;
2929
-- ############################################################################
3030

3131
create microflow TestModule.MF_WorkflowActions (
32-
$workflow: System.workflow,
32+
$workflow: System.Workflow,
3333
$ContextObj: TestModule.DeliveryContext,
3434
$UserTask: System.WorkflowUserTask
3535
)

mdl-examples/mes/02-catalog-domain-model.mdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ index (SKU);
151151
*/
152152
@position(350, 250)
153153
create persistent entity ProductCatalog.ProductImage
154-
extends System.image (
154+
extends System.Image (
155155
/** Caption describing the image */
156156
ImageCaption: string(500),
157157
/** Whether this is the primary display image */

mdl/executor/cmd_businessevents.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ func createBusinessEventService(ctx *ExecContext, stmt *ast.CreateBusinessEventS
331331
msg.TypeName = "BusinessEvents$Message"
332332

333333
// Set publish/subscribe based on operation
334-
switch strings.ToUpper(msgDef.Operation) {
334+
switch strings.ToLower(msgDef.Operation) {
335335
case "publish":
336336
msg.CanSubscribe = true // Service publishes → others subscribe
337337
case "subscribe":

mdl/executor/cmd_catalog.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ func captureDescribe(ctx *ExecContext, objectType string, qualifiedName string)
655655
defer func() { ctx.Output = origOutput }()
656656

657657
var err error
658-
switch strings.ToUpper(objectType) {
658+
switch strings.ToLower(objectType) {
659659
case "entity":
660660
err = describeEntity(ctx, qn)
661661
case "microflow", "nanoflow":
@@ -713,7 +713,7 @@ func captureDescribeParallel(ctx *ExecContext, objectType string, qualifiedName
713713
}
714714

715715
var err error
716-
switch strings.ToUpper(objectType) {
716+
switch strings.ToLower(objectType) {
717717
case "entity":
718718
err = describeEntity(localCtx, qn)
719719
case "microflow", "nanoflow":

mdl/executor/cmd_mermaid.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ func describeMermaid(ctx *ExecContext, objectType, name string) error {
3030
qn = ast.QualifiedName{Module: name}
3131
}
3232

33-
switch strings.ToUpper(objectType) {
34-
case "entity", "DOMAINMODEL":
33+
switch strings.ToLower(objectType) {
34+
case "entity", "domainmodel":
3535
return domainModelToMermaid(ctx, qn.Module)
3636
case "microflow":
3737
return microflowToMermaid(ctx, qn)

mdl/executor/cmd_pages_builder_v3.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func (pb *pageBuilder) buildWidgetV3(w *ast.WidgetV3) (pages.Widget, error) {
257257
var widget pages.Widget
258258
var err error
259259

260-
switch strings.ToUpper(w.Type) {
260+
switch strings.ToLower(w.Type) {
261261
case "dataview":
262262
widget, err = pb.buildDataViewV3(w)
263263
case "datagrid":

0 commit comments

Comments
 (0)