Skip to content

[Runtime] Choose the serialization method based on content type #12

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 11 commits into from
Jun 8, 2023
12 changes: 9 additions & 3 deletions Sources/OpenAPIRuntime/Base/EncodableBodyContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@

/// A wrapper of a body value with its content type.
@_spi(Generated)
public struct EncodableBodyContent<T: Encodable & Equatable>: Equatable {
public struct EncodableBodyContent<T: Equatable>: Equatable {

/// An encodable body value.
public var value: T

/// The header value of the content type, for example `application/json`.
public var contentType: String

/// Creates a new content wrapper around the specified value and content type.
public init(value: T, contentType: String) {
/// Creates a new content wrapper.
/// - Parameters:
/// - value: An encodable body value.
/// - contentType: The header value of the content type.
public init(
value: T,
contentType: String
) {
self.value = value
self.contentType = contentType
}
Expand Down
Loading