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
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ jobs:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
linux_5_10_enabled: false
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_1_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_2_arguments_override: "--explicit-target-dependency-import-check error"
Expand All @@ -24,12 +23,12 @@ jobs:
windows_6_0_enabled: true
windows_6_1_enabled: true
windows_6_2_enabled: true
windows_nightly_6_1_enabled: true
windows_nightly_next_enabled: true
windows_nightly_main_enabled: true
windows_6_0_arguments_override: "--explicit-target-dependency-import-check error"
windows_6_1_arguments_override: "--explicit-target-dependency-import-check error"
windows_6_2_arguments_override: "--explicit-target-dependency-import-check error"
windows_nightly_6_1_arguments_override: "--explicit-target-dependency-import-check error"
windows_nightly_next_arguments_override: "--explicit-target-dependency-import-check error"
windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

construct-integration-test-matrix:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ jobs:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
linux_5_10_enabled: false
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_1_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_2_arguments_override: "--explicit-target-dependency-import-check error"
Expand All @@ -28,12 +27,12 @@ jobs:
windows_6_0_enabled: true
windows_6_1_enabled: true
windows_6_2_enabled: true
windows_nightly_6_1_enabled: true
windows_nightly_next_enabled: true
windows_nightly_main_enabled: true
windows_6_0_arguments_override: "--explicit-target-dependency-import-check error"
windows_6_1_arguments_override: "--explicit-target-dependency-import-check error"
windows_6_2_arguments_override: "--explicit-target-dependency-import-check error"
windows_nightly_6_1_arguments_override: "--explicit-target-dependency-import-check error"
windows_nightly_next_arguments_override: "--explicit-target-dependency-import-check error"
windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

construct-integration-test-matrix:
Expand Down
3 changes: 3 additions & 0 deletions .swiftformatignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
**Package.swift
Sources/OpenAPIRuntime/EventStreams/JSONLinesDecoding.swift
Sources/OpenAPIRuntime/EventStreams/JSONSequenceDecoding.swift
Sources/OpenAPIRuntime/EventStreams/ServerSentEventsDecoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Benchmark
import OpenAPIRuntime
import Foundation

let benchmarks = {
let benchmarks: @Sendable () -> Void = {
let defaultMetrics: [BenchmarkMetric] = [.mallocCountTotal, .cpuTotal]

Benchmark(
Expand Down
2 changes: 1 addition & 1 deletion Benchmarks/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.9
// swift-tools-version: 6.0
import PackageDescription

let package = Package(
Expand Down
31 changes: 19 additions & 12 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.9
// swift-tools-version: 6.0
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftOpenAPIGenerator open source project
Expand Down Expand Up @@ -51,16 +51,23 @@ let package = Package(
]
)

// --- 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
}
var settings = target.swiftSettings ?? []

// https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md
// Require `any` for existential types.
settings.append(.enableUpcomingFeature("ExistentialAny"))

// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md
settings.append(.enableUpcomingFeature("MemberImportVisibility"))

// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0409-access-level-on-imports.md
settings.append(.enableUpcomingFeature("InternalImportsByDefault"))

#if compiler(>=6.2)
// Ensure all public types are explicitly annotated as Sendable or not Sendable.
settings.append(.unsafeFlags(["-Xfrontend", "-require-explicit-sendable"]))
#endif

target.swiftSettings = settings
}
// --- END: STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- //
2 changes: 2 additions & 0 deletions Sources/OpenAPIRuntime/Base/Acceptable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// Full Foundation needed for String(format:)
import Foundation

/// The protocol that all generated `AcceptableContentType` enums conform to.
Expand Down
4 changes: 4 additions & 0 deletions Sources/OpenAPIRuntime/Base/Base64EncodedData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// A type for converting data as a base64 string.
///
Expand Down
7 changes: 5 additions & 2 deletions Sources/OpenAPIRuntime/Base/ContentDisposition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// Full Foundation needed for String.trimmingCharacters
import Foundation

/// A parsed representation of the `content-disposition` header described by RFC 6266 containing only
Expand Down Expand Up @@ -105,9 +107,10 @@ extension ContentDisposition: RawRepresentable {
var components = rawValue.split(separator: ";").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
guard !components.isEmpty else { return nil }
self.dispositionType = DispositionType(rawValue: components.removeFirst())
let parameterTuples: [(ParameterName, String)] = components.compactMap { component in
let parameterTuples: [(ParameterName, String)] = components.compactMap {
(component: String) -> (ParameterName, String)? in
let parameterComponents = component.split(separator: "=", maxSplits: 1)
.map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
.map { $0.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) }
guard parameterComponents.count == 2 else { return nil }
let valueWithoutQuotes = parameterComponents[1].trimmingCharacters(in: ["\""])
return (.init(rawValue: parameterComponents[0]), valueWithoutQuotes)
Expand Down
2 changes: 2 additions & 0 deletions Sources/OpenAPIRuntime/Base/CopyOnWriteBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
}
}

@available(*, unavailable) extension CopyOnWriteBox.Storage: Sendable {}

extension CopyOnWriteBox: Encodable where Wrapped: Encodable {

/// Encodes this value into the given encoder.
Expand Down
5 changes: 5 additions & 0 deletions Sources/OpenAPIRuntime/Base/OpenAPIMIMEType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// A container for a parsed, valid MIME type.
@_spi(Generated) public struct OpenAPIMIMEType: Equatable, Sendable {
Expand Down
10 changes: 2 additions & 8 deletions Sources/OpenAPIRuntime/Base/OpenAPIValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(Foundation)
#if canImport(Darwin)
import class Foundation.NSNull
#else
@preconcurrency import class Foundation.NSNull
#endif
import class Foundation.NSNumber
// Full Foundation needed for NSNull
import Foundation
#if canImport(CoreFoundation)
import CoreFoundation
#endif
#endif

/// A container for a value represented by JSON Schema.
///
Expand Down
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
4 changes: 3 additions & 1 deletion Sources/OpenAPIRuntime/Conversion/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import Foundation

// Full Foundation needed for NSLock
public import Foundation

/// A type that allows customization of Date encoding and decoding.
///
Expand Down
3 changes: 2 additions & 1 deletion Sources/OpenAPIRuntime/Conversion/Converter+Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import Foundation
import HTTPTypes
public import HTTPTypes

extension Converter {

Expand Down
7 changes: 6 additions & 1 deletion Sources/OpenAPIRuntime/Conversion/Converter+Common.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
import HTTPTypes
#endif
public import HTTPTypes

extension Converter {

Expand Down
3 changes: 2 additions & 1 deletion Sources/OpenAPIRuntime/Conversion/Converter+Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import Foundation
import HTTPTypes
public import HTTPTypes

extension Converter {

Expand Down
8 changes: 4 additions & 4 deletions Sources/OpenAPIRuntime/Conversion/Converter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
#if canImport(Darwin)
import class Foundation.JSONEncoder

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
@preconcurrency import class Foundation.JSONEncoder
import Foundation
#endif
import class Foundation.JSONDecoder

/// Converter between generated and HTTP currency types.
@_spi(Generated) public struct Converter: Sendable {
Expand Down
1 change: 1 addition & 0 deletions Sources/OpenAPIRuntime/Conversion/CurrencyExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import Foundation
import HTTPTypes

Expand Down
1 change: 1 addition & 0 deletions Sources/OpenAPIRuntime/Conversion/ErrorExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import Foundation

extension DecodingError {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import Foundation

extension String {
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
7 changes: 6 additions & 1 deletion Sources/OpenAPIRuntime/Conversion/URLExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import Foundation

#if canImport(FoundationEssentials)
public import FoundationEssentials
#else
public import Foundation
#endif

extension URL {
/// Returns the default server URL of "/".
Expand Down
7 changes: 6 additions & 1 deletion Sources/OpenAPIRuntime/Deprecated/Deprecated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import Foundation

#if canImport(FoundationEssentials)
public import FoundationEssentials
#else
public import Foundation
#endif
import HTTPTypes

// MARK: - Functionality to be removed in the future
Expand Down
9 changes: 2 additions & 7 deletions Sources/OpenAPIRuntime/Errors/ClientError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@
//
//===----------------------------------------------------------------------===//

import HTTPTypes
#if canImport(Darwin)
import struct Foundation.URL
#else
@preconcurrency import struct Foundation.URL
#endif
import protocol Foundation.LocalizedError
public import Foundation
public import HTTPTypes

/// An error thrown by a client performing an OpenAPI operation.
///
Expand Down
5 changes: 5 additions & 0 deletions Sources/OpenAPIRuntime/Errors/CodingErrors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension DecodingError: PrettyStringConvertible {
var prettyDescription: String {
Expand Down
8 changes: 6 additions & 2 deletions Sources/OpenAPIRuntime/Errors/RuntimeError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import protocol Foundation.LocalizedError
import struct Foundation.Data

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import HTTPTypes

/// Error thrown by generated code.
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 Foundation
public import HTTPTypes

/// An error thrown by a server handling an OpenAPI operation.
public struct ServerError: Error, HTTPResponseConvertible {
Expand Down
Loading
Loading