Skip to content

Commit 9858a80

Browse files
Revert "Serialize OpenApiDate values properly to short date (#1102)"
This reverts commit 1a7392f.
1 parent 81bcd3c commit 9858a80

4 files changed

+4
-7
lines changed

src/Microsoft.OpenApi/Any/OpenApiPrimitive.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
118118

119119
case PrimitiveType.Date:
120120
var dateValue = (OpenApiDate)(IOpenApiPrimitive)this;
121-
writer.WriteValue(dateValue.Value.ToShortDateString());
121+
writer.WriteValue(dateValue.Value);
122122
break;
123123

124124
case PrimitiveType.DateTime:

test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
}
2222
]
2323
}
24-
],
25-
"aDate": "12/12/2022"
24+
]
2625
}
2726
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"value":{"versions":[{"status":"Status1","id":"v1","links":[{"href":"http://example.com/1","rel":"sampleRel1"}]},{"status":"Status2","id":"v2","links":[{"href":"http://example.com/2","rel":"sampleRel2"}]}],"aDate":"12/12/2022"}}
1+
{"value":{"versions":[{"status":"Status1","id":"v1","links":[{"href":"http://example.com/1","rel":"sampleRel1"}]},{"status":"Status2","id":"v2","links":[{"href":"http://example.com/2","rel":"sampleRel2"}]}]}}

test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4-
using System;
54
using System.Globalization;
65
using System.IO;
76
using System.Text;
@@ -96,8 +95,7 @@ public class OpenApiExampleTests
9695
}
9796
}
9897
}
99-
},
100-
["aDate"] = new OpenApiDate(DateTime.Parse("12/12/2022 00:00:00"))
98+
}
10199
}
102100
};
103101

0 commit comments

Comments
 (0)