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

[Runtime] Add headerFields and body to UndocumentedPayload #90

Merged
merged 1 commit into from
Dec 15, 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 @@ -12,6 +12,8 @@
//
//===----------------------------------------------------------------------===//

import HTTPTypes

/// A payload value used by undocumented operation responses.
///
/// Each operation's `Output` enum type needs to exhaustively
Expand All @@ -20,6 +22,19 @@
/// `undocumented` enum case is used when such a status code is
/// detected.
public struct UndocumentedPayload: Sendable, Hashable {
/// Creates a new payload.
public init() {}

/// The header fields contained in the response.
public var headerFields: HTTPFields

/// The body stream of this part, if present.
public var body: HTTPBody?

/// Creates a new part.
/// - Parameters:
/// - headerFields: The header fields contained in the response.
/// - body: The body stream of this part, if present.
public init(headerFields: HTTPFields = [:], body: HTTPBody? = nil) {
self.headerFields = headerFields
self.body = body
}
}
7 changes: 7 additions & 0 deletions Sources/OpenAPIRuntime/Deprecated/Deprecated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ import Foundation
import HTTPTypes

// MARK: - Functionality to be removed in the future

extension UndocumentedPayload {
/// Creates a new payload.
@available(*, deprecated, renamed: "init(headerFields:body:)") @_disfavoredOverload public init() {
self.init(headerFields: [:], body: nil)
}
}
simonjbeaumont marked this conversation as resolved.
Show resolved Hide resolved