FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add TimeSpan handling to TypeExtensions by sophiedasinger · Pull Request #230 · microsoft/OpenAPI.NET.CSharpAnnotations · GitHub

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

Add TimeSpan handling to TypeExtensions - #230

Open
Sophie (sophiedasinger) wants to merge 2 commits into
microsoft:masterfrom
sophiedasinger:master
Open

Add TimeSpan handling to TypeExtensions#230
Sophie (sophiedasinger) wants to merge 2 commits into
microsoft:masterfrom
sophiedasinger:master

Conversation

Copy link
Copy Markdown

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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Shweta Patil (Shwetap05) Feb 10, 2020
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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)

Shweta Patil (Shwetap05) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

🕐

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL