From 699e9d96922b744173e63726a882a89f59450c59 Mon Sep 17 00:00:00 2001 From: Sandra Persson Date: Fri, 24 Oct 2025 14:48:31 +0200 Subject: [PATCH 1/3] compile arrayobj --- APLSource/Core/CompileObject.aplf | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/APLSource/Core/CompileObject.aplf b/APLSource/Core/CompileObject.aplf index 194bfdd..e1003b9 100644 --- a/APLSource/Core/CompileObject.aplf +++ b/APLSource/Core/CompileObject.aplf @@ -1,4 +1,4 @@ - r←depth CompileObject(toolsdir obj name);propnames;properties;mask;f;nstdclassmask;classnames;toolspath;componentspath + r←depth CompileObject(toolsdir obj name);arrayobjmask;propnames;properties;mask;f;nstdclassmask;classnames;toolspath;componentspath r←⍬ r,←⊂':Class ',name toolspath←(∊depth/⊂'##.'),toolsdir @@ -18,6 +18,8 @@ propnames←obj.properties.⎕NL ¯9 properties←obj.properties⍎¨propnames nstdclassmask←{⍵.(0≠⎕NC'type'):⊃⍵.(0≠⎕NC'properties')∧⍵.type≡'object' ⋄ 0}¨properties + arrayobjmask←{6::0 ⋄ (⍵.type≡'array')∧(⍵.items.type≡'object')∧0<≢⍵.items.properties}¨properties + nstdclassmask∨←arrayobjmask classnames←nstdclassmask{⍺:⍵,'Class' ⋄ ''}¨propnames r,←⊂' ∇ make0' r,←⊂' :Access Public Instance' @@ -48,9 +50,13 @@ r,←⊂'' r,←⊂' :Property Simple ',1↓∊',',¨(mask/propnames),¨⊂'Add' r,←⊂' :Access Public Instance' - r,←⊂' ∇ r←get args;ind' + r,←⊂' ∇ r←get args;ind;class' r,←⊂' ind←∆propertyNames⍳⊂¯3↓args.Name' - r,←⊂' r←(⊃⎕RSI).⎕NEW getComponent(ind⊃∆properties).items' + r,←⊂' :If 0<≢class←ind⊃nestedObjnames' + r,←⊂' r←⎕NEW⍎class' + r,←⊂' :Else' + r,←⊂' r←(⊃⎕RSI).⎕NEW getComponent(ind⊃∆properties).items' + r,←⊂' :EndIf' r,←⊂' (ind⊃fieldValues),←r' r,←⊂' (ind⊃isSet)←1' r,←⊂' ∇' @@ -58,6 +64,9 @@ :EndIf r,←⊂'' :If ∨/nstdclassmask + :If ∨/arrayobjmask + (arrayobjmask/properties)←(arrayobjmask/properties).items + :EndIf depth+←1 f←depth CompileObject¨↓(⊂toolsdir),nstdclassmask⌿properties,⍪classnames r,←¨{(⊂' '),¨(⊂''),⍵}¨f From 76befae4f70e6971345827305c7dca53668bc9b0 Mon Sep 17 00:00:00 2001 From: Sandra Persson Date: Mon, 27 Oct 2025 10:24:04 +0100 Subject: [PATCH 2/3] testdata and test --- APLSource/Tests/UnitTests/arrayProps_test.aplf | 5 +++++ Testdata/test-ODA.json | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 APLSource/Tests/UnitTests/arrayProps_test.aplf diff --git a/APLSource/Tests/UnitTests/arrayProps_test.aplf b/APLSource/Tests/UnitTests/arrayProps_test.aplf new file mode 100644 index 0000000..025240f --- /dev/null +++ b/APLSource/Tests/UnitTests/arrayProps_test.aplf @@ -0,0 +1,5 @@ + arrayProps_test;c;rqb + rqb←TestClasses.TestODA.AddThing.NewRequestBody + c←rqb.colour + (0 Try⍎)'c.TotalCostAdd' + Assert 1=≢c.TotalCost diff --git a/Testdata/test-ODA.json b/Testdata/test-ODA.json index dc627e8..bf87291 100644 --- a/Testdata/test-ODA.json +++ b/Testdata/test-ODA.json @@ -402,6 +402,23 @@ }, "hex": { "type": "string" + }, + "TotalCost": { + "type": "array", + "items": { + "type": "object", + "properties": { + "cost": { + "type": "string" + }, + "primary": { + "type": "string" + }, + "currency": { + "type": "string" + } + } + } } } }, From a0377da3aab6797dd1357c437b25fbf3d696adc8 Mon Sep 17 00:00:00 2001 From: Sandra Persson Date: Mon, 27 Oct 2025 11:03:39 +0100 Subject: [PATCH 3/3] deleted duplicate line --- APLSource/Core/CompileObject.aplf | 1 - 1 file changed, 1 deletion(-) diff --git a/APLSource/Core/CompileObject.aplf b/APLSource/Core/CompileObject.aplf index e1003b9..8a7bd0a 100644 --- a/APLSource/Core/CompileObject.aplf +++ b/APLSource/Core/CompileObject.aplf @@ -42,7 +42,6 @@ r,←⊂' (ind⊃isSet)←1' r,←⊂' ∇' r,←⊂' :EndProperty' - properties←obj.properties⍎¨propnames mask←properties.(∧/0≠⎕NC'type' 'items') :If ∨/mask mask←mask\(mask/properties).type∊⊂'array'