Commit 4d296d1
feat(program-d): C# codegen PATCHes + validates value-object jsonb columns
Value-object jsonb columns (field.object @storage:jsonb, single AND @isarray)
are EF owned-nav properties invisible to the PATCH merge loop's FindProperty and
to the create handler's top-level TryValidateObject. Now:
- EntityGenerator splits validation attrs from EF-mapping attrs so VO POCOs carry
[Required(AllowEmptyStrings=true)]/[MaxLength]/... + [JsonPropertyName] (pins the
stored jsonb keys to the camelCase metadata field names).
- RoutesGenerator emits typed per-field VO merge arms (deserialize -> recursive
validate -> assign the CLR owned-nav; EF .ToJson persists via full-document
replacement) + per-VO POST validation; present-null clears a nullable column but
400s a @required one, driven by @required METADATA not EF nullability; a
post-save raw UPDATE NULLs a nullable array column (EF OwnsMany.ToJson writes []
for a null nav, never SQL NULL).
- New ValueObjectValidator (Codegen.Runtime, the established generated-code helper
namespace): TryValidateObject per element + manual recursion into nested VO
members (spec section 0 — TryValidateObject is non-recursive).
Both lanes green (reference + generated full-stack over Testcontainers PG, all 20
VO scenarios); Codegen.Tests 278/0; persistence roundtrip 24/24 (Label/Settings
VO POCOs unaffected); other api-contract lanes 40/40 — no regression.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NGQ7oSuNcjhsMHWwZzhBwr1 parent 7a5e576 commit 4d296d1
8 files changed
Lines changed: 549 additions & 73 deletions
File tree
- server/csharp
- MetaObjects.Codegen.Tests
- MetaObjects.Codegen
- Generators
- Runtime
- MetaObjects.IntegrationTests
- Api
- Generated
Lines changed: 106 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
Lines changed: 34 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
569 | 572 | | |
570 | 573 | | |
571 | 574 | | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
572 | 579 | | |
573 | 580 | | |
574 | 581 | | |
| |||
593 | 600 | | |
594 | 601 | | |
595 | 602 | | |
596 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
597 | 606 | | |
598 | 607 | | |
599 | 608 | | |
600 | 609 | | |
601 | 610 | | |
602 | 611 | | |
603 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
604 | 616 | | |
605 | 617 | | |
606 | 618 | | |
| |||
756 | 768 | | |
757 | 769 | | |
758 | 770 | | |
759 | | - | |
760 | | - | |
761 | | - | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
762 | 780 | | |
763 | 781 | | |
764 | 782 | | |
765 | 783 | | |
766 | 784 | | |
767 | 785 | | |
768 | 786 | | |
769 | | - | |
| 787 | + | |
770 | 788 | | |
| 789 | + | |
771 | 790 | | |
772 | 791 | | |
773 | 792 | | |
| |||
784 | 803 | | |
785 | 804 | | |
786 | 805 | | |
787 | | - | |
788 | 806 | | |
789 | | - | |
| 807 | + | |
| 808 | + | |
790 | 809 | | |
791 | | - | |
792 | 810 | | |
793 | 811 | | |
794 | 812 | | |
| |||
797 | 815 | | |
798 | 816 | | |
799 | 817 | | |
| 818 | + | |
| 819 | + | |
800 | 820 | | |
801 | 821 | | |
802 | 822 | | |
803 | 823 | | |
804 | 824 | | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
805 | 831 | | |
806 | 832 | | |
807 | 833 | | |
| |||
0 commit comments