Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Conversation

sophiedasinger
Copy link

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

[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},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TimeSpan?) [](start = 24, length = 10)

add a unit test case or update existing to cover this datatype

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@Shwetap05 Shwetap05 Feb 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Member

@Shwetap05 Shwetap05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants