Skip to content

Commit bd45309

Browse files
committed
Fix: Reorder Entity properties to match JSON schema for stable serialization
- Reordered Entity.cs properties from (GraphQL, Rest, Mcp, Permissions) to (Rest, GraphQL, Mcp, Permissions) - Updated constructor parameters to match property order - Fixed test files using old constructor parameter order - Accepted snapshots with corrected property ordering This ensures System.Text.Json serialization produces consistent output, preventing snapshot test failures in pipelines where deserialization-reserialize cycles would produce different property ordering.
1 parent f585814 commit bd45309

7 files changed

+482
-482
lines changed

src/Config/ObjectModel/Entity.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public record Entity
4747
public bool ShouldSerializeFields() => false;
4848
#pragma warning restore CA1822
4949

50-
public EntityGraphQLOptions GraphQL { get; init; }
5150
public EntityRestOptions Rest { get; init; }
51+
public EntityGraphQLOptions GraphQL { get; init; }
5252
public EntityMcpOptions? Mcp { get; init; }
5353
public EntityPermission[] Permissions { get; init; }
5454
public Dictionary<string, string>? Mappings { get; init; }
@@ -62,9 +62,9 @@ public record Entity
6262
[JsonConstructor]
6363
public Entity(
6464
EntitySource Source,
65-
EntityGraphQLOptions GraphQL,
6665
List<FieldMetadata>? Fields,
6766
EntityRestOptions Rest,
67+
EntityGraphQLOptions GraphQL,
6868
EntityMcpOptions? Mcp,
6969
EntityPermission[] Permissions,
7070
Dictionary<string, string>? Mappings,
@@ -77,8 +77,8 @@ public Entity(
7777
this.Health = Health;
7878
this.Source = Source;
7979
this.Fields = Fields;
80-
this.GraphQL = GraphQL;
8180
this.Rest = Rest;
81+
this.GraphQL = GraphQL;
8282
this.Mcp = Mcp;
8383
this.Permissions = Permissions;
8484
this.Mappings = Mappings;

src/Service.Tests/Snapshots/ConfigurationTests.TestReadingRuntimeConfigForCosmos.verified.txt

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636
Source: {
3737
Object: graphqldb.planet
3838
},
39+
Rest: {
40+
Enabled: false
41+
},
3942
GraphQL: {
4043
Singular: Planet,
4144
Plural: Planets,
4245
Enabled: true
4346
},
44-
Rest: {
45-
Enabled: false
46-
},
4747
Permissions: [
4848
{
4949
Role: anonymous,
@@ -108,14 +108,14 @@
108108
Source: {
109109
Object: graphqldb.planet
110110
},
111+
Rest: {
112+
Enabled: false
113+
},
111114
GraphQL: {
112115
Singular: Character,
113116
Plural: Characters,
114117
Enabled: true
115118
},
116-
Rest: {
117-
Enabled: false
118-
},
119119
Permissions: [
120120
{
121121
Role: anonymous,
@@ -150,14 +150,14 @@
150150
Source: {
151151
Object: graphqldb.planet
152152
},
153+
Rest: {
154+
Enabled: false
155+
},
153156
GraphQL: {
154157
Singular: Star,
155158
Plural: Stars,
156159
Enabled: true
157160
},
158-
Rest: {
159-
Enabled: false
160-
},
161161
Permissions: [
162162
{
163163
Role: anonymous,
@@ -201,14 +201,14 @@
201201
Source: {
202202
Object: graphqldb.planet
203203
},
204+
Rest: {
205+
Enabled: false
206+
},
204207
GraphQL: {
205208
Singular: Tag,
206209
Plural: Tags,
207210
Enabled: true
208211
},
209-
Rest: {
210-
Enabled: false
211-
},
212212
Permissions: [
213213
{
214214
Role: anonymous,
@@ -235,14 +235,14 @@
235235
Source: {
236236
Object: graphqldb.planet
237237
},
238+
Rest: {
239+
Enabled: false
240+
},
238241
GraphQL: {
239242
Singular: Moon,
240243
Plural: Moons,
241244
Enabled: true
242245
},
243-
Rest: {
244-
Enabled: false
245-
},
246246
Permissions: [
247247
{
248248
Role: anonymous,
@@ -286,14 +286,14 @@
286286
Source: {
287287
Object: graphqldb.planet
288288
},
289+
Rest: {
290+
Enabled: false
291+
},
289292
GraphQL: {
290293
Singular: Earth,
291294
Plural: Earths,
292295
Enabled: true
293296
},
294-
Rest: {
295-
Enabled: false
296-
},
297297
Permissions: [
298298
{
299299
Role: field-mutation-with-read-permission,
@@ -381,14 +381,14 @@
381381
Source: {
382382
Object: graphqldb.planet
383383
},
384+
Rest: {
385+
Enabled: false
386+
},
384387
GraphQL: {
385388
Singular: Sun,
386389
Plural: Suns,
387390
Enabled: true
388391
},
389-
Rest: {
390-
Enabled: false
391-
},
392392
Permissions: [
393393
{
394394
Role: anonymous,
@@ -423,14 +423,14 @@
423423
Source: {
424424
Object: graphqldb.planet
425425
},
426+
Rest: {
427+
Enabled: false
428+
},
426429
GraphQL: {
427430
Singular: AdditionalAttribute,
428431
Plural: AdditionalAttributes,
429432
Enabled: true
430433
},
431-
Rest: {
432-
Enabled: false
433-
},
434434
Permissions: [
435435
{
436436
Role: anonymous,
@@ -459,14 +459,14 @@
459459
Source: {
460460
Object: graphqldb.planet
461461
},
462+
Rest: {
463+
Enabled: false
464+
},
462465
GraphQL: {
463466
Singular: MoonAdditionalAttribute,
464467
Plural: MoonAdditionalAttributes,
465468
Enabled: true
466469
},
467-
Rest: {
468-
Enabled: false
469-
},
470470
Permissions: [
471471
{
472472
Role: anonymous,
@@ -495,14 +495,14 @@
495495
Source: {
496496
Object: graphqldb.planet
497497
},
498+
Rest: {
499+
Enabled: false
500+
},
498501
GraphQL: {
499502
Singular: MoreAttribute,
500503
Plural: MoreAttributes,
501504
Enabled: true
502505
},
503-
Rest: {
504-
Enabled: false
505-
},
506506
Permissions: [
507507
{
508508
Role: anonymous,
@@ -567,14 +567,14 @@
567567
Source: {
568568
Object: graphqldb.newcontainer
569569
},
570+
Rest: {
571+
Enabled: false
572+
},
570573
GraphQL: {
571574
Singular: PlanetAgain,
572575
Plural: PlanetAgains,
573576
Enabled: true
574577
},
575-
Rest: {
576-
Enabled: false
577-
},
578578
Permissions: [
579579
{
580580
Role: field-mutation-with-read-permission,
@@ -722,14 +722,14 @@
722722
Source: {
723723
Object: graphqldb.invalidAuthModelContainer
724724
},
725+
Rest: {
726+
Enabled: false
727+
},
725728
GraphQL: {
726729
Singular: InvalidAuthModel,
727730
Plural: InvalidAuthModels,
728731
Enabled: true
729732
},
730-
Rest: {
731-
Enabled: false
732-
},
733733
Permissions: [
734734
{
735735
Role: anonymous,

0 commit comments

Comments
 (0)