Skip to content
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
13 changes: 12 additions & 1 deletion Sources/OpenAPIKit/ExternalLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@
import OpenAPIKitCore
import Foundation

// Once we hit language version 6.2 we get warnings (errors for Swift 6
// language mode) if the ExternalLoader is not a SendableMetatype. We just
// split this conformance requirement out into a trivial base protocol to make
// it easy to have different behavior for different language versions. Prior to
// Swift 6.2, SendableMetatype is not even available.
#if compiler(>=6.2.0)
public protocol _ExternalLoaderMetatype: SendableMetatype {}
#else
public protocol _ExternalLoaderMetatype {}
#endif

/// An `ExternalLoader` enables `OpenAPIKit` to load external references
/// without knowing the details of what decoder is being used or how new internal
/// references should be named.
public protocol ExternalLoader where Message: Sendable {
public protocol ExternalLoader: _ExternalLoaderMetatype where Message: Sendable {
/// This can be anything that an implementor of this protocol wants to pass back from
/// the `load()` function and have available after all external loading has been done.
///
Expand Down
13 changes: 12 additions & 1 deletion Sources/OpenAPIKit30/ExternalLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@
import OpenAPIKitCore
import Foundation

// Once we hit language version 6.2 we get warnings (errors for Swift 6
// language mode) if the ExternalLoader is not a SendableMetatype. We just
// split this conformance requirement out into a trivial base protocol to make
// it easy to have different behavior for different language versions. Prior to
// Swift 6.2, SendableMetatype is not even available.
#if compiler(>=6.2.0)
public protocol _ExternalLoaderMetatype: SendableMetatype {}
#else
public protocol _ExternalLoaderMetatype {}
#endif

/// An `ExternalLoader` enables `OpenAPIKit` to load external references
/// without knowing the details of what decoder is being used or how new internal
/// references should be named.
public protocol ExternalLoader where Message: Sendable {
public protocol ExternalLoader: _ExternalLoaderMetatype where Message: Sendable {
/// This can be anything that an implementor of this protocol wants to pass back from
/// the `load()` function and have available after all external loading has been done.
///
Expand Down