Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exported OpenApi uses unexpected type for date. #1529

Open
julasamer opened this issue Oct 9, 2020 · 1 comment · May be fixed by #1531
Open

Exported OpenApi uses unexpected type for date. #1529

julasamer opened this issue Oct 9, 2020 · 1 comment · May be fixed by #1531

Comments

@julasamer
Copy link

julasamer commented Oct 9, 2020

Context and Description

The OpenApi spec says, that for dates, the field should use {"type":"string", "format": "date-time"}. The inofficial standard format for dates seems to be ISO 8601.

Fields that contain Dates are exported as {"type": "number"} by Kitura.

This is unfortunate because, when generating a client library from that spec, the date field with have a numeric type instead of date. This is not the case when the field uses {"type":"string", "format": "date-time"}.

I attempted to configure the JSON encoder and decoder with dateEncodingStrategy = .iso8601. This changes the typo to string, but still doesn't contain the format, so the generated code will have a field of type String, not Date.

Environment Details

Mac OS 10.15, Xcode 12.0.1, Swift 5.3, Kitura 2.9.1

Steps to Reproduce

Create a struct with a Date field and a route returning that struct, look at the OpenAPI specification.

Expected vs. Actual Behaviour

  • [ Expected] The date type is {"type":"string", "format": "date-time"}, at least after setting the date encoding strategy to .iso8601.
  • [ Actual] Date type is number or string without format
@mbarnach mbarnach linked a pull request Oct 13, 2020 that will close this issue
2 tasks
@mbarnach
Copy link
Member

@julasamer Thanks for the report. Could you try if the PR #1531 is fixing your issue?

@mbarnach mbarnach self-assigned this Oct 13, 2020
@mbarnach mbarnach linked a pull request Oct 13, 2020 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants