Add TimeSpan handling to TypeExtensions#230
Add TimeSpan handling to TypeExtensions#230sophiedasinger wants to merge 2 commits intomicrosoft:masterfrom
Conversation
| [typeof(double?)] = () => new OpenApiSchema {Type = "number", Format = "double", Nullable = true}, | ||
| [typeof(decimal?)] = () => new OpenApiSchema {Type = "number", Format = "double", Nullable = true}, | ||
| [typeof(DateTime?)] = () => new OpenApiSchema {Type = "string", Format = "date-time", Nullable = true}, | ||
| [typeof(TimeSpan?)] = () => new OpenApiSchema {Type = "string", Nullable = true}, |
There was a problem hiding this comment.
TimeSpan?) [](start = 24, length = 10)
add a unit test case or update existing to cover this datatype
There was a problem hiding this comment.
Will add this in, thanks! I couldn't locate existing unit tests for this class but it may be indirectly tested somewhere else; I'll do some digging.
There was a problem hiding this comment.
Most of the test call the generator method directly, you can update any existing xml used in test https://github.com/microsoft/OpenAPI.NET.CSharpAnnotations/blob/master/test/Microsoft.OpenApi.CSharpAnnotations.DocumentGeneration.Tests/OpenApiDocumentGeneratorTests/OpenApiDocumentGeneratorTest.cs to use a timespan type and update the expected json
In reply to: 377244341 [](ancestors = 377244341)
My team is using the OpenAPI ADO build tasks to generate the OpenAPI JSON spec from our REST API. Really appreciate the nice integration with our ADO build pipelines!
We've run into a small issue with TimeSpan handling, since these properties are returned in the serialized JSON response as strings. Please let me know if there is any additional process around submitting changes to this repository, or if there is a different recommended approach here. Thanks!
Previously reported in #217