Skip to content

Commit 4e81bf9

Browse files
committed
Maintain ordering of properties as specified in fixedFieldMap by doing a union of fixed field map keys and property names in the map node
1 parent 845f314 commit 4e81bf9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Microsoft.OpenApi.Readers/V2/OpenApiV2Deserializer.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ private static void ParseMap<T>(
2929
return;
3030
}
3131

32-
foreach (var propertyNode in mapNode)
32+
var allFields = fixedFieldMap.Keys.Union(mapNode.Select(x => x.Name));
33+
foreach (var propertyNode in allFields)
3334
{
34-
propertyNode.ParseField(domainObject, fixedFieldMap, patternFieldMap);
35-
requiredFields?.Remove(propertyNode.Name);
35+
mapNode[propertyNode]?.ParseField(domainObject, fixedFieldMap, patternFieldMap);
36+
requiredFields?.Remove(propertyNode);
3637
}
3738
}
3839

0 commit comments

Comments
 (0)