-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[Swift6] Remove ParameterConvertible for models #21150
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,8 +51,10 @@ extension UUID: ParameterConvertible { | |
func asParameter(codableHelper: CodableHelper) -> any Sendable { self } | ||
} | ||
|
||
extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { | ||
func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } | ||
extension RawRepresentable where RawValue: ParameterConvertible { | ||
func asParameter(codableHelper: CodableHelper) -> any Sendable { | ||
rawValue.asParameter(codableHelper: codableHelper) | ||
} | ||
} | ||
|
||
private func encodeIfPossible<T: Sendable>(_ object: T, codableHelper: CodableHelper) -> any Sendable { | ||
|
@@ -95,15 +97,6 @@ extension Date: ParameterConvertible { | |
func asParameter(codableHelper: CodableHelper) -> any Sendable { | ||
return codableHelper.dateFormatter.string(from: self) | ||
} | ||
} | ||
|
||
extension ParameterConvertible where Self: Encodable { | ||
func asParameter(codableHelper: CodableHelper) -> any Sendable { | ||
guard let data = try? codableHelper.jsonEncoder.encode(self) else { | ||
fatalError("Could not encode to json: \(self)") | ||
} | ||
return data.asParameter(codableHelper: codableHelper) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking, would it be wrong to just return the data here? Instead of removing this entire block? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @x-sheep when you have some time, could you please take a look at this? Thanks |
||
} | ||
}{{/useVapor}}{{#generateModelAdditionalProperties}} | ||
|
||
extension String: @retroactive CodingKey { | ||
|
Uh oh!
There was an error while loading. Please reload this page.