Skip to content
Closed
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
14 changes: 13 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
66 changes: 66 additions & 0 deletions Package@swift-6.0.swift
Original file line number Diff line number Diff line change
@@ -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 --- //
66 changes: 66 additions & 0 deletions Package@swift-6.1.swift
Original file line number Diff line number Diff line change
@@ -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 --- //
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Base/UndocumentedPayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

import HTTPTypes
public import HTTPTypes

/// A payload value used by undocumented operation responses.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Conversion/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Conversion/Converter+Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import Foundation
import HTTPTypes
public import HTTPTypes

extension Converter {

Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Conversion/Converter+Common.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import Foundation
import HTTPTypes
public import HTTPTypes

extension Converter {

Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Conversion/Converter+Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import Foundation
import HTTPTypes
public import HTTPTypes

extension Converter {

Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Conversion/ServerVariable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

import Foundation
public import Foundation

extension URL {
/// Returns a validated server URL created from the URL template, or
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Conversion/URLExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import Foundation
public import Foundation

extension URL {
/// Returns the default server URL of "/".
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Deprecated/Deprecated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Sources/OpenAPIRuntime/Errors/ClientError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenAPIRuntime/Errors/ServerError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions Sources/OpenAPIRuntime/EventStreams/JSONLinesDecoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Upstream: AsyncSequence & Sendable>: Sendable
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenAPIRuntime/EventStreams/JSONLinesEncoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Upstream: AsyncSequence & Sendable>: Sendable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenAPIRuntime/Interface/ClientTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//

import HTTPTypes
import struct Foundation.URL
public import HTTPTypes
public import struct Foundation.URL

/// A type that performs HTTP operations.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Interface/CurrencyTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

import HTTPTypes
public import HTTPTypes
import Foundation

/// A container for request metadata already parsed and validated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

import HTTPTypes
public import HTTPTypes

/// An opt-in error handling middleware that converts an error to an HTTP response.
///
Expand Down
6 changes: 3 additions & 3 deletions Sources/OpenAPIRuntime/Interface/HTTPBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIRuntime/Interface/ServerTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

import HTTPTypes
public import HTTPTypes

/// A type that registers and handles HTTP operations.
///
Expand Down
Loading
Loading