diff --git a/Package.swift b/Package.swift index 58fc1d4d..b473859d 100644 --- a/Package.swift +++ b/Package.swift @@ -18,7 +18,19 @@ import PackageDescription let swiftSettings: [SwiftSetting] = [ // https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md // Require `any` for existential types. - .enableUpcomingFeature("ExistentialAny") + .enableUpcomingFeature("ExistentialAny"), + + // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md + .enableUpcomingFeature("MemberImportVisibility"), + + // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0409-access-level-on-imports.md + .enableUpcomingFeature("InternalImportsByDefault"), + + // https://docs.swift.org/compiler/documentation/diagnostics/nonisolated-nonsending-by-default/ + .enableUpcomingFeature("NonisolatedNonsendingByDefault"), + + // Ensure all public types are explicitly annotated as Sendable or not Sendable. + .unsafeFlags(["-Xfrontend", "-require-explicit-sendable"]), ] let package = Package( diff --git a/Package@swift-6.0.swift b/Package@swift-6.0.swift new file mode 100644 index 00000000..58fc1d4d --- /dev/null +++ b/Package@swift-6.0.swift @@ -0,0 +1,66 @@ +// swift-tools-version: 5.9 +//===----------------------------------------------------------------------===// +// +// This source file is part of the SwiftOpenAPIGenerator open source project +// +// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of SwiftOpenAPIGenerator project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// +import PackageDescription + +// General Swift-settings for all targets. +let swiftSettings: [SwiftSetting] = [ + // https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md + // Require `any` for existential types. + .enableUpcomingFeature("ExistentialAny") +] + +let package = Package( + name: "swift-openapi-runtime", + platforms: [ + .macOS(.v10_15), .macCatalyst(.v13), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1) + ], + products: [ + .library( + name: "OpenAPIRuntime", + targets: ["OpenAPIRuntime"] + ) + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-http-types", from: "1.0.0"), + ], + targets: [ + .target( + name: "OpenAPIRuntime", + dependencies: [ + .product(name: "HTTPTypes", package: "swift-http-types") + ], + swiftSettings: swiftSettings + ), + .testTarget( + name: "OpenAPIRuntimeTests", + dependencies: ["OpenAPIRuntime"], + swiftSettings: swiftSettings + ), + ] +) + +// --- STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- // +for target in package.targets { + switch target.type { + case .regular, .test, .executable: + var settings = target.swiftSettings ?? [] + // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md + settings.append(.enableUpcomingFeature("MemberImportVisibility")) + target.swiftSettings = settings + case .macro, .plugin, .system, .binary: () // not applicable + @unknown default: () // we don't know what to do here, do nothing + } +} +// --- END: STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- // diff --git a/Package@swift-6.1.swift b/Package@swift-6.1.swift new file mode 100644 index 00000000..58fc1d4d --- /dev/null +++ b/Package@swift-6.1.swift @@ -0,0 +1,66 @@ +// swift-tools-version: 5.9 +//===----------------------------------------------------------------------===// +// +// This source file is part of the SwiftOpenAPIGenerator open source project +// +// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of SwiftOpenAPIGenerator project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// +import PackageDescription + +// General Swift-settings for all targets. +let swiftSettings: [SwiftSetting] = [ + // https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md + // Require `any` for existential types. + .enableUpcomingFeature("ExistentialAny") +] + +let package = Package( + name: "swift-openapi-runtime", + platforms: [ + .macOS(.v10_15), .macCatalyst(.v13), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1) + ], + products: [ + .library( + name: "OpenAPIRuntime", + targets: ["OpenAPIRuntime"] + ) + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-http-types", from: "1.0.0"), + ], + targets: [ + .target( + name: "OpenAPIRuntime", + dependencies: [ + .product(name: "HTTPTypes", package: "swift-http-types") + ], + swiftSettings: swiftSettings + ), + .testTarget( + name: "OpenAPIRuntimeTests", + dependencies: ["OpenAPIRuntime"], + swiftSettings: swiftSettings + ), + ] +) + +// --- STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- // +for target in package.targets { + switch target.type { + case .regular, .test, .executable: + var settings = target.swiftSettings ?? [] + // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md + settings.append(.enableUpcomingFeature("MemberImportVisibility")) + target.swiftSettings = settings + case .macro, .plugin, .system, .binary: () // not applicable + @unknown default: () // we don't know what to do here, do nothing + } +} +// --- END: STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- // diff --git a/Sources/OpenAPIRuntime/Base/UndocumentedPayload.swift b/Sources/OpenAPIRuntime/Base/UndocumentedPayload.swift index 399256de..9b16bc03 100644 --- a/Sources/OpenAPIRuntime/Base/UndocumentedPayload.swift +++ b/Sources/OpenAPIRuntime/Base/UndocumentedPayload.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import HTTPTypes +public import HTTPTypes /// A payload value used by undocumented operation responses. /// diff --git a/Sources/OpenAPIRuntime/Conversion/Configuration.swift b/Sources/OpenAPIRuntime/Conversion/Configuration.swift index 2ee7ab00..279d1d46 100644 --- a/Sources/OpenAPIRuntime/Conversion/Configuration.swift +++ b/Sources/OpenAPIRuntime/Conversion/Configuration.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -import Foundation +public import Foundation /// A type that allows customization of Date encoding and decoding. /// diff --git a/Sources/OpenAPIRuntime/Conversion/Converter+Client.swift b/Sources/OpenAPIRuntime/Conversion/Converter+Client.swift index 28abbdb2..dcaa27b2 100644 --- a/Sources/OpenAPIRuntime/Conversion/Converter+Client.swift +++ b/Sources/OpenAPIRuntime/Conversion/Converter+Client.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// import Foundation -import HTTPTypes +public import HTTPTypes extension Converter { diff --git a/Sources/OpenAPIRuntime/Conversion/Converter+Common.swift b/Sources/OpenAPIRuntime/Conversion/Converter+Common.swift index 73f8fecb..f4ff8852 100644 --- a/Sources/OpenAPIRuntime/Conversion/Converter+Common.swift +++ b/Sources/OpenAPIRuntime/Conversion/Converter+Common.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// import Foundation -import HTTPTypes +public import HTTPTypes extension Converter { diff --git a/Sources/OpenAPIRuntime/Conversion/Converter+Server.swift b/Sources/OpenAPIRuntime/Conversion/Converter+Server.swift index a3088bd3..f108c7f6 100644 --- a/Sources/OpenAPIRuntime/Conversion/Converter+Server.swift +++ b/Sources/OpenAPIRuntime/Conversion/Converter+Server.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// import Foundation -import HTTPTypes +public import HTTPTypes extension Converter { diff --git a/Sources/OpenAPIRuntime/Conversion/ServerVariable.swift b/Sources/OpenAPIRuntime/Conversion/ServerVariable.swift index a9658afa..69bf219d 100644 --- a/Sources/OpenAPIRuntime/Conversion/ServerVariable.swift +++ b/Sources/OpenAPIRuntime/Conversion/ServerVariable.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import Foundation +public import Foundation extension URL { /// Returns a validated server URL created from the URL template, or diff --git a/Sources/OpenAPIRuntime/Conversion/URLExtensions.swift b/Sources/OpenAPIRuntime/Conversion/URLExtensions.swift index 432d78ae..b4eb5898 100644 --- a/Sources/OpenAPIRuntime/Conversion/URLExtensions.swift +++ b/Sources/OpenAPIRuntime/Conversion/URLExtensions.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -import Foundation +public import Foundation extension URL { /// Returns the default server URL of "/". diff --git a/Sources/OpenAPIRuntime/Deprecated/Deprecated.swift b/Sources/OpenAPIRuntime/Deprecated/Deprecated.swift index 2ce41750..188a599d 100644 --- a/Sources/OpenAPIRuntime/Deprecated/Deprecated.swift +++ b/Sources/OpenAPIRuntime/Deprecated/Deprecated.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -import Foundation +public import Foundation import HTTPTypes // MARK: - Functionality to be removed in the future diff --git a/Sources/OpenAPIRuntime/Errors/ClientError.swift b/Sources/OpenAPIRuntime/Errors/ClientError.swift index eb0c8005..83dbc157 100644 --- a/Sources/OpenAPIRuntime/Errors/ClientError.swift +++ b/Sources/OpenAPIRuntime/Errors/ClientError.swift @@ -12,13 +12,13 @@ // //===----------------------------------------------------------------------===// -import HTTPTypes +public import HTTPTypes #if canImport(Darwin) -import struct Foundation.URL +public import struct Foundation.URL #else -@preconcurrency import struct Foundation.URL +@preconcurrency public import struct Foundation.URL #endif -import protocol Foundation.LocalizedError +public import protocol Foundation.LocalizedError /// An error thrown by a client performing an OpenAPI operation. /// diff --git a/Sources/OpenAPIRuntime/Errors/ServerError.swift b/Sources/OpenAPIRuntime/Errors/ServerError.swift index adcb2687..835889d1 100644 --- a/Sources/OpenAPIRuntime/Errors/ServerError.swift +++ b/Sources/OpenAPIRuntime/Errors/ServerError.swift @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -import HTTPTypes -import protocol Foundation.LocalizedError +public import HTTPTypes +public import protocol Foundation.LocalizedError /// An error thrown by a server handling an OpenAPI operation. public struct ServerError: Error, HTTPResponseConvertible { diff --git a/Sources/OpenAPIRuntime/EventStreams/JSONLinesDecoding.swift b/Sources/OpenAPIRuntime/EventStreams/JSONLinesDecoding.swift index eed9acdc..69c26723 100644 --- a/Sources/OpenAPIRuntime/EventStreams/JSONLinesDecoding.swift +++ b/Sources/OpenAPIRuntime/EventStreams/JSONLinesDecoding.swift @@ -13,11 +13,11 @@ //===----------------------------------------------------------------------===// #if canImport(Darwin) -import class Foundation.JSONDecoder +public import class Foundation.JSONDecoder #else -@preconcurrency import class Foundation.JSONDecoder +@preconcurrency public import class Foundation.JSONDecoder #endif -import struct Foundation.Data +public import struct Foundation.Data /// A sequence that parses arbitrary byte chunks into lines using the JSON Lines format. public struct JSONLinesDeserializationSequence: Sendable diff --git a/Sources/OpenAPIRuntime/EventStreams/JSONLinesEncoding.swift b/Sources/OpenAPIRuntime/EventStreams/JSONLinesEncoding.swift index f1d9b9b8..6c200d80 100644 --- a/Sources/OpenAPIRuntime/EventStreams/JSONLinesEncoding.swift +++ b/Sources/OpenAPIRuntime/EventStreams/JSONLinesEncoding.swift @@ -13,9 +13,9 @@ //===----------------------------------------------------------------------===// #if canImport(Darwin) -import class Foundation.JSONEncoder +public import class Foundation.JSONEncoder #else -@preconcurrency import class Foundation.JSONEncoder +@preconcurrency public import class Foundation.JSONEncoder #endif /// A sequence that serializes lines by concatenating them using the JSON Lines format. diff --git a/Sources/OpenAPIRuntime/EventStreams/JSONSequenceDecoding.swift b/Sources/OpenAPIRuntime/EventStreams/JSONSequenceDecoding.swift index 4b34658c..1e281666 100644 --- a/Sources/OpenAPIRuntime/EventStreams/JSONSequenceDecoding.swift +++ b/Sources/OpenAPIRuntime/EventStreams/JSONSequenceDecoding.swift @@ -13,12 +13,12 @@ //===----------------------------------------------------------------------===// #if canImport(Darwin) -import class Foundation.JSONDecoder +public import class Foundation.JSONDecoder #else -@preconcurrency import class Foundation.JSONDecoder +@preconcurrency public import class Foundation.JSONDecoder #endif -import protocol Foundation.LocalizedError -import struct Foundation.Data +public import protocol Foundation.LocalizedError +public import struct Foundation.Data /// A sequence that parses arbitrary byte chunks into lines using the JSON Sequence format. public struct JSONSequenceDeserializationSequence: Sendable diff --git a/Sources/OpenAPIRuntime/EventStreams/JSONSequenceEncoding.swift b/Sources/OpenAPIRuntime/EventStreams/JSONSequenceEncoding.swift index a6ffe940..343233e1 100644 --- a/Sources/OpenAPIRuntime/EventStreams/JSONSequenceEncoding.swift +++ b/Sources/OpenAPIRuntime/EventStreams/JSONSequenceEncoding.swift @@ -13,9 +13,9 @@ //===----------------------------------------------------------------------===// #if canImport(Darwin) -import class Foundation.JSONEncoder +public import class Foundation.JSONEncoder #else -@preconcurrency import class Foundation.JSONEncoder +@preconcurrency public import class Foundation.JSONEncoder #endif /// A sequence that serializes lines by concatenating them using the JSON Sequence format. diff --git a/Sources/OpenAPIRuntime/EventStreams/ServerSentEventsDecoding.swift b/Sources/OpenAPIRuntime/EventStreams/ServerSentEventsDecoding.swift index 34f51b21..2ee107c7 100644 --- a/Sources/OpenAPIRuntime/EventStreams/ServerSentEventsDecoding.swift +++ b/Sources/OpenAPIRuntime/EventStreams/ServerSentEventsDecoding.swift @@ -13,11 +13,11 @@ //===----------------------------------------------------------------------===// #if canImport(Darwin) -import class Foundation.JSONDecoder +public import class Foundation.JSONDecoder #else -@preconcurrency import class Foundation.JSONDecoder +@preconcurrency public import class Foundation.JSONDecoder #endif -import struct Foundation.Data +public import struct Foundation.Data /// A sequence that parses arbitrary byte chunks into events using the Server-sent Events format. /// diff --git a/Sources/OpenAPIRuntime/EventStreams/ServerSentEventsEncoding.swift b/Sources/OpenAPIRuntime/EventStreams/ServerSentEventsEncoding.swift index 853d76d2..aa0c6b28 100644 --- a/Sources/OpenAPIRuntime/EventStreams/ServerSentEventsEncoding.swift +++ b/Sources/OpenAPIRuntime/EventStreams/ServerSentEventsEncoding.swift @@ -13,9 +13,9 @@ //===----------------------------------------------------------------------===// #if canImport(Darwin) -import class Foundation.JSONEncoder +public import class Foundation.JSONEncoder #else -@preconcurrency import class Foundation.JSONEncoder +@preconcurrency public import class Foundation.JSONEncoder #endif /// A sequence that serializes Server-sent Events. diff --git a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift index cb20c651..29cdeff7 100644 --- a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift +++ b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -import HTTPTypes -import struct Foundation.URL +public import HTTPTypes +public import struct Foundation.URL /// A type that performs HTTP operations. /// diff --git a/Sources/OpenAPIRuntime/Interface/CurrencyTypes.swift b/Sources/OpenAPIRuntime/Interface/CurrencyTypes.swift index 9e3e4542..2fa34280 100644 --- a/Sources/OpenAPIRuntime/Interface/CurrencyTypes.swift +++ b/Sources/OpenAPIRuntime/Interface/CurrencyTypes.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import HTTPTypes +public import HTTPTypes import Foundation /// A container for request metadata already parsed and validated diff --git a/Sources/OpenAPIRuntime/Interface/ErrorHandlingMiddleware.swift b/Sources/OpenAPIRuntime/Interface/ErrorHandlingMiddleware.swift index 1fb49409..d03fcb86 100644 --- a/Sources/OpenAPIRuntime/Interface/ErrorHandlingMiddleware.swift +++ b/Sources/OpenAPIRuntime/Interface/ErrorHandlingMiddleware.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import HTTPTypes +public import HTTPTypes /// An opt-in error handling middleware that converts an error to an HTTP response. /// diff --git a/Sources/OpenAPIRuntime/Interface/HTTPBody.swift b/Sources/OpenAPIRuntime/Interface/HTTPBody.swift index 59292ec9..f15ea3ee 100644 --- a/Sources/OpenAPIRuntime/Interface/HTTPBody.swift +++ b/Sources/OpenAPIRuntime/Interface/HTTPBody.swift @@ -12,9 +12,9 @@ // //===----------------------------------------------------------------------===// -import class Foundation.NSLock -import protocol Foundation.LocalizedError -import struct Foundation.Data // only for convenience initializers +public import class Foundation.NSLock +public import protocol Foundation.LocalizedError +public import struct Foundation.Data // only for convenience initializers /// A body of an HTTP request or HTTP response. /// diff --git a/Sources/OpenAPIRuntime/Interface/ServerTransport.swift b/Sources/OpenAPIRuntime/Interface/ServerTransport.swift index 0984ed21..a1f35eaf 100644 --- a/Sources/OpenAPIRuntime/Interface/ServerTransport.swift +++ b/Sources/OpenAPIRuntime/Interface/ServerTransport.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import HTTPTypes +public import HTTPTypes /// A type that registers and handles HTTP operations. /// diff --git a/Sources/OpenAPIRuntime/Interface/UniversalClient.swift b/Sources/OpenAPIRuntime/Interface/UniversalClient.swift index 5afff2b1..04d221b3 100644 --- a/Sources/OpenAPIRuntime/Interface/UniversalClient.swift +++ b/Sources/OpenAPIRuntime/Interface/UniversalClient.swift @@ -11,11 +11,11 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -import HTTPTypes +public import HTTPTypes #if canImport(Darwin) -import struct Foundation.URL +public import struct Foundation.URL #else -@preconcurrency import struct Foundation.URL +@preconcurrency public import struct Foundation.URL #endif /// OpenAPI document-agnostic HTTP client used by OpenAPI document-specific, diff --git a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift index 2153ccea..4457c229 100644 --- a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift +++ b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift @@ -12,13 +12,13 @@ // //===----------------------------------------------------------------------===// -import HTTPTypes +public import HTTPTypes #if canImport(Darwin) -import struct Foundation.URL +public import struct Foundation.URL #else -@preconcurrency import struct Foundation.URL +@preconcurrency public import struct Foundation.URL #endif -import struct Foundation.URLComponents +public import struct Foundation.URLComponents /// OpenAPI document-agnostic HTTP server used by OpenAPI document-specific, /// generated servers to perform request deserialization, middleware and handler diff --git a/Sources/OpenAPIRuntime/Multipart/MultipartPublicTypes.swift b/Sources/OpenAPIRuntime/Multipart/MultipartPublicTypes.swift index 6db356c3..8b46224a 100644 --- a/Sources/OpenAPIRuntime/Multipart/MultipartPublicTypes.swift +++ b/Sources/OpenAPIRuntime/Multipart/MultipartPublicTypes.swift @@ -13,7 +13,7 @@ //===----------------------------------------------------------------------===// import Foundation -import HTTPTypes +public import HTTPTypes /// A raw multipart part containing the header fields and the body stream. public struct MultipartRawPart: Sendable, Hashable { diff --git a/Sources/OpenAPIRuntime/Multipart/MultipartPublicTypesExtensions.swift b/Sources/OpenAPIRuntime/Multipart/MultipartPublicTypesExtensions.swift index ac9d9d5f..4f24530a 100644 --- a/Sources/OpenAPIRuntime/Multipart/MultipartPublicTypesExtensions.swift +++ b/Sources/OpenAPIRuntime/Multipart/MultipartPublicTypesExtensions.swift @@ -13,7 +13,7 @@ //===----------------------------------------------------------------------===// import Foundation -import HTTPTypes +public import HTTPTypes // MARK: - Extensions diff --git a/Tests/OpenAPIRuntimeTests/Conversion/Test_Converter+Client.swift b/Tests/OpenAPIRuntimeTests/Conversion/Test_Converter+Client.swift index e223ea53..edf76748 100644 --- a/Tests/OpenAPIRuntimeTests/Conversion/Test_Converter+Client.swift +++ b/Tests/OpenAPIRuntimeTests/Conversion/Test_Converter+Client.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -import XCTest +public import XCTest @_spi(Generated) import OpenAPIRuntime import HTTPTypes diff --git a/Tests/OpenAPIRuntimeTests/Test_Runtime.swift b/Tests/OpenAPIRuntimeTests/Test_Runtime.swift index 37184d58..070b66a3 100644 --- a/Tests/OpenAPIRuntimeTests/Test_Runtime.swift +++ b/Tests/OpenAPIRuntimeTests/Test_Runtime.swift @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -import XCTest -@_spi(Generated) @testable import OpenAPIRuntime +public import XCTest +@_spi(Generated) @testable public import OpenAPIRuntime import HTTPTypes class Test_Runtime: XCTestCase {