Repository navigation
Commit 8040ee8
simplify: ask each question once, and in the place that already owns the answer
Cleanup pass over the map work. Nothing here changes what a correct model generates,
with one deliberate exception noted below.
**Sort allowlist → the canonical band.** Both sort allowlists now ask
`FilterOps.supportsFiltering(subType)` — the cross-port answer the filter side already
uses and the loader itself checks in `validateSortableHasSupportedSubtype`. This
closes a hole the hand-listed version had left: the TPH base allowlist still skipped
only `ObjectField`, so a map was unsortable on a vanilla entity and sortable on a TPH
base. Hand-maintained exclusion lists are how that happened; a shared band cannot
drift from the loader.
**One predicate for "which value object does this map carry."** `SpringTypeMapper`
was resolving `@objectRef` itself and accepting ANY target, while its sibling requires
`object.value` — so `@objectRef` naming an entity typed a component as that entity
while nothing emitted a record for it. It now calls the sibling. The FQN rule gets a
name (`fqJavaTypeName`), and the array-wrap rule gets one (`wrapsAsList`) so its two
call sites state it once instead of twice.
**One emitter for element-wise PATCH validation.** The map branch was the array branch
copy-pasted with a renamed loop variable, leaving the 400 envelope in three places.
**C#: gate the helper on what was emitted, not a second derivation of it.**
`NeedsMapJsonbHelper` hand-mirrored three emission sites and was wrong about two —
it undercounted them and did not model `jsonbObjectsOnly` suppressing the flattened
arm. Replaced by a scan of `modelLines`, which is complete at that point: exact by
construction. `MapJsonbSuffix` likewise keeps the top-level and flattened tiers from
drifting.
**The one behavior change — the emitted comparer.** It compared serialized JSON, which
is key-ORDER sensitive: a dictionary rebuilt in a different order read as changed and
would issue an UPDATE for a row nothing touched. It also serialized both dictionaries
on every equality check and deep-copied on every snapshot. Now entry-wise, with
scalars settling on `EqualityComparer<T>.Default` and never serializing; only a
value-object value falls through to JSON, because the generated POCO compares by
reference. The snapshot deep-copies only when the value type needs it. Pinned by test.
**Two KNOWN_GAPS files that had become false.** C# G9 ("a field.map member of a
flattened value object gets no EF column mapping") described the gap this work closed,
prescribed "do not use field.map inside a flattened value object", and pinned itself
to a test renamed two commits ago — while the generator's surviving warning still
says "See KNOWN_GAPS.md". Marked closed with what replaced it. G7's contract clause
called a map an owned navigation, which the converter path contradicts. The Java entry
said field.map was "still staged out, needs a persistence-conformance roundtrip column
first" — the codegen rung did not depend on that gate, but the gate is still open and
still right for the RUNTIME tier, which is now what it says.
**Tests.** A drift gate pins the map's `@valueType` table against `javaTypeName`'s own
arms, so adding a scalar subtype to one and not the other fails instead of shipping a
divergent map. The hand-rolled javac block became
`SpringTestFixtures.compileGenerated` — the 17th copy in the package, and now the
last one that needs writing. Dropped a test wholly subsumed by the table test and a
compile-fixture field covered by two other receivers.
Java 246 green on `clean test`; C# 442 + 1024 + 291 + 77 green.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013sjn9TaHoZFdDPF2dLcppv1 parent cf29990 commit 8040ee8
12 files changed
Lines changed: 308 additions & 224 deletions
File tree
- server
- csharp
- MetaObjects.Codegen.Tests
- MetaObjects.Codegen/Generators
- java/codegen-spring/src
- main/java/com/metaobjects/generator/spring
- test/java/com/metaobjects/generator/spring
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
83 | 81 | | |
84 | 82 | | |
85 | 83 | | |
| |||
111 | 109 | | |
112 | 110 | | |
113 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
| |||
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 132 | + | |
| 133 | + | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| |||
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 154 | + | |
160 | 155 | | |
161 | 156 | | |
162 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
235 | 241 | | |
236 | 242 | | |
237 | 243 | | |
| |||
635 | 641 | | |
636 | 642 | | |
637 | 643 | | |
638 | | - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
639 | 656 | | |
640 | 657 | | |
641 | | - | |
642 | | - | |
643 | | - | |
| 658 | + | |
| 659 | + | |
644 | 660 | | |
645 | 661 | | |
646 | 662 | | |
| |||
664 | 680 | | |
665 | 681 | | |
666 | 682 | | |
667 | | - | |
668 | | - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
669 | 686 | | |
670 | 687 | | |
671 | 688 | | |
| |||
682 | 699 | | |
683 | 700 | | |
684 | 701 | | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
689 | 710 | | |
690 | 711 | | |
691 | 712 | | |
| |||
710 | 731 | | |
711 | 732 | | |
712 | 733 | | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
717 | 775 | | |
718 | | - | |
| 776 | + | |
719 | 777 | | |
720 | 778 | | |
721 | 779 | | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | 780 | | |
745 | 781 | | |
746 | 782 | | |
| |||
1067 | 1103 | | |
1068 | 1104 | | |
1069 | 1105 | | |
1070 | | - | |
1071 | 1106 | | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
| 1107 | + | |
1075 | 1108 | | |
1076 | 1109 | | |
1077 | 1110 | | |
| |||
0 commit comments