Skip to content

fix: Correct data type of date-formatted strings #137

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

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ struct TypeMatcher {
typeName = .swift("String")
case .binary:
typeName = .foundation("Data")
case .date, .dateTime:
case .dateTime:
typeName = .foundation("Date")
default:
typeName = .swift("String")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Below is a list of the "dimensions" across which the helper methods differ:
- **Swift type** represents the generated type in Swift that best represents the JSON schema defined in the OpenAPI document. For example, a `string` schema is generated as `Swift.String`, an `object` schema is generated as a Swift structure, and an `array` schema is generated as a `Swift.Array` generic over the element type. For the helper methods, it's important which protocol they conform to, as those are used for serialization. Values:
- _string-convertible_ refers to types that conform to `LosslessStringConvertible`
- _array of string-convertibles_ refers to an array of types that conform to `LosslessStringConvertible`
- _date_ is represented by `Foundation.Date`
- _array of dates_ refers to an array of `Foundation.Date`
- _date-time_ is represented by `Foundation.Date`
- _array of date-times_ refers to an array of `Foundation.Date`
- _codable_ refers to types that conform to `Codable`
- _data_ is represented by `Foundation.Data`
- **Optional/required** represents whether the method works with optional values. Values:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class Test_TypeMatcher: Test_Core {
(.string, "Swift.String"),
(.string(.init(format: .byte), .init()), "Swift.String"),
(.string(.init(format: .binary), .init()), "Foundation.Data"),
(.string(.init(format: .date), .init()), "Foundation.Date"),
(.string(.init(format: .date), .init()), "Swift.String"),
(.string(.init(format: .dateTime), .init()), "Foundation.Date"),

(.integer, "Swift.Int"),
Expand Down