From f3c32ccfd202efa5382169739204dc431711b65e Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Mon, 6 Jan 2025 13:09:49 +0100 Subject: [PATCH] Add missing imports to fix Swift 6.1+ (#709) ### Motivation Currently unit tests on Swift 6.1+ toolchains are failing due to a few missing imports. That these are coming up is good, that's why we've enabled `MemberImportVisibility`. ### Modifications Add the missing imports to stop relying on implicitly imported extension methods. ### Result Unit tests compile again on Swift 6.1+. ### Test Plan Tested locally, will further verify CI is happy. --- .github/workflows/pull_request.yml | 2 +- .../_OpenAPIGeneratorCore/Extensions/SwiftStandardLibrary.swift | 2 ++ .../Translator/CommonTypes/StructBlueprint.swift | 1 + .../Translator/Content/ContentInspector.swift | 1 + .../Translator/TypesTranslator/translateServersVariables.swift | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 5638abf6..525cdb98 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -21,7 +21,7 @@ jobs: linux_5_10_arguments_override: "--explicit-target-dependency-import-check error" linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error" - linux_nightly_main_enabled: false + linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error" integration-test: name: Integration test diff --git a/Sources/_OpenAPIGeneratorCore/Extensions/SwiftStandardLibrary.swift b/Sources/_OpenAPIGeneratorCore/Extensions/SwiftStandardLibrary.swift index 1a335612..f334ebf5 100644 --- a/Sources/_OpenAPIGeneratorCore/Extensions/SwiftStandardLibrary.swift +++ b/Sources/_OpenAPIGeneratorCore/Extensions/SwiftStandardLibrary.swift @@ -11,6 +11,8 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// +import Foundation + extension Int { /// Returns the digits for the number using the specified radix. /// - Parameter radix: The radix used to format the integer. diff --git a/Sources/_OpenAPIGeneratorCore/Translator/CommonTypes/StructBlueprint.swift b/Sources/_OpenAPIGeneratorCore/Translator/CommonTypes/StructBlueprint.swift index 7a516a1d..7a3d2260 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/CommonTypes/StructBlueprint.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/CommonTypes/StructBlueprint.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// import OpenAPIKit +import Foundation /// A structure that contains the information about an OpenAPI object that is /// required to generate a matching Swift structure. diff --git a/Sources/_OpenAPIGeneratorCore/Translator/Content/ContentInspector.swift b/Sources/_OpenAPIGeneratorCore/Translator/Content/ContentInspector.swift index f78f5e9f..cc4cf8fc 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/Content/ContentInspector.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/Content/ContentInspector.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// import OpenAPIKit +import Foundation /// Utilities for asking questions about OpenAPI.Content extension FileTranslator { diff --git a/Sources/_OpenAPIGeneratorCore/Translator/TypesTranslator/translateServersVariables.swift b/Sources/_OpenAPIGeneratorCore/Translator/TypesTranslator/translateServersVariables.swift index c4a8e803..712a74a8 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/TypesTranslator/translateServersVariables.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/TypesTranslator/translateServersVariables.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// import OpenAPIKit +import Foundation /// Represents a server variable and the function of generation that should be applied. protocol ServerVariableGenerator {