Skip to content

Commit

Permalink
Revert "Serialize OpenApiDate values properly to short date (#1102)"
Browse files Browse the repository at this point in the history
This reverts commit 1a7392f.
  • Loading branch information
MaggieKimani1 authored Jan 5, 2023
1 parent 81bcd3c commit 9858a80
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Any/OpenApiPrimitive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)

case PrimitiveType.Date:
var dateValue = (OpenApiDate)(IOpenApiPrimitive)this;
writer.WriteValue(dateValue.Value.ToShortDateString());
writer.WriteValue(dateValue.Value);
break;

case PrimitiveType.DateTime:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
}
]
}
],
"aDate": "12/12/2022"
]
}
}
Original file line number Diff line number Diff line change
@@ -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"}}
{"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"}]}]}}
4 changes: 1 addition & 3 deletions test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System;
using System.Globalization;
using System.IO;
using System.Text;
Expand Down Expand Up @@ -96,8 +95,7 @@ public class OpenApiExampleTests
}
}
}
},
["aDate"] = new OpenApiDate(DateTime.Parse("12/12/2022 00:00:00"))
}
}
};

Expand Down

0 comments on commit 9858a80

Please sign in to comment.