From 70f60d043e24bb2f5ecb894ac1afb2685dc8e597 Mon Sep 17 00:00:00 2001 From: Anton Titkov Date: Thu, 23 Oct 2025 03:47:57 +0300 Subject: [PATCH 1/5] Bump OpenAPIKit version --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index f2705fef..cdb703d6 100644 --- a/Package.swift +++ b/Package.swift @@ -45,8 +45,8 @@ let package = Package( .package(url: "https://github.com/apple/swift-collections", from: "1.1.4"), // Read OpenAPI documents - .package(url: "https://github.com/mattpolzin/OpenAPIKit", from: "3.9.0"), - .package(url: "https://github.com/jpsim/Yams", "4.0.0"..<"7.0.0"), + .package(url: "https://github.com/mattpolzin/OpenAPIKit", from: "4.0.0"), + .package(url: "https://github.com/jpsim/Yams", "5.1.0"..<"7.0.0"), // CLI Tool .package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"), From 29b994e9abd5b5adecc0cf2af0d2f1ed0e38063c Mon Sep 17 00:00:00 2001 From: Anton Titkov Date: Thu, 23 Oct 2025 03:47:57 +0300 Subject: [PATCH 2/5] Update OpenAPI.Content.Encoding usage according to OpenAPIKit v4 Migration Guide --- .../Translator/TypeAssignment/Test_TypeMatcher.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/OpenAPIGeneratorCoreTests/Translator/TypeAssignment/Test_TypeMatcher.swift b/Tests/OpenAPIGeneratorCoreTests/Translator/TypeAssignment/Test_TypeMatcher.swift index ec8aafc7..45e5944e 100644 --- a/Tests/OpenAPIGeneratorCoreTests/Translator/TypeAssignment/Test_TypeMatcher.swift +++ b/Tests/OpenAPIGeneratorCoreTests/Translator/TypeAssignment/Test_TypeMatcher.swift @@ -245,7 +245,7 @@ final class Test_TypeMatcher: Test_Core { static let multipartElementTypeReferenceIfReferenceableTypes: [(UnresolvedSchema?, OrderedDictionary?, String?)] = [ (nil, nil, nil), (.b(.string), nil, nil), (.a(.component(named: "Foo")), nil, "Foo"), - (.a(.component(named: "Foo")), ["foo": .init(contentType: .json)], nil), + (.a(.component(named: "Foo")), ["foo": .init(contentTypes: [.json])], nil), ] func testMultipartElementTypeReferenceIfReferenceableTypes() throws { for (schema, encoding, name) in Self.multipartElementTypeReferenceIfReferenceableTypes { From 591125057281d4415c267d4942c171182dd1b6e8 Mon Sep 17 00:00:00 2001 From: Anton Titkov Date: Thu, 23 Oct 2025 03:47:57 +0300 Subject: [PATCH 3/5] Update wording for `testEmitsComplexOpenAPIParsingError` and `testSchemaWarningsForwardedToGeneratorDiagnostics` --- Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift | 2 +- .../Translator/TypesTranslator/Test_translateSchemas.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift b/Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift index 46bcd029..71939e14 100644 --- a/Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift +++ b/Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift @@ -126,7 +126,7 @@ final class Test_YamsParser: Test_Core { /foo.yaml: error: Found neither a $ref nor a PathItem in Document.paths['/system']. PathItem could not be decoded because: - Inconsistency encountered when parsing `Vendor Extension` for the **GET** endpoint under `/system`: Found at least one vendor extension property that does not begin with the required 'x-' prefix. Invalid properties: [ resonance ].. + Problem encountered when parsing `Vendor Extension` for the **GET** endpoint under `/system`: Found at least one vendor extension property that does not begin with the required 'x-' prefix. Invalid properties: [ resonance ].. """ assertThrownError(try _test(yaml), expectedDiagnostic: expected) } diff --git a/Tests/OpenAPIGeneratorCoreTests/Translator/TypesTranslator/Test_translateSchemas.swift b/Tests/OpenAPIGeneratorCoreTests/Translator/TypesTranslator/Test_translateSchemas.swift index 1d1e89f5..ee25c10f 100644 --- a/Tests/OpenAPIGeneratorCoreTests/Translator/TypesTranslator/Test_translateSchemas.swift +++ b/Tests/OpenAPIGeneratorCoreTests/Translator/TypesTranslator/Test_translateSchemas.swift @@ -35,7 +35,7 @@ class Test_translateSchemas: Test_Core { ( schemaWithWarnings, [ - "warning: Schema warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"]. [context: codingPath=, contextString=, subjectName=OpenAPI Schema]" + "warning: Schema warning: Problem encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"]. [context: codingPath=, contextString=, subjectName=OpenAPI Schema]" ] ), ] From 62fe491051904970723b98e4831a34fbe8c30664 Mon Sep 17 00:00:00 2001 From: Anton Titkov Date: Thu, 23 Oct 2025 03:47:57 +0300 Subject: [PATCH 4/5] Update checks for null values --- .../Translator/CommonTranslations/translateRawEnum.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/_OpenAPIGeneratorCore/Translator/CommonTranslations/translateRawEnum.swift b/Sources/_OpenAPIGeneratorCore/Translator/CommonTranslations/translateRawEnum.swift index 737abe57..e1b984eb 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/CommonTranslations/translateRawEnum.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/CommonTranslations/translateRawEnum.swift @@ -100,7 +100,9 @@ extension FileTranslator { // In nullable enum schemas, empty strings are parsed as Void. // This is unlikely to be fixed, so handling that case here. // https://github.com/apple/swift-openapi-generator/issues/118 - if isNullable && anyValue is Void { + // Also handle nil values in nullable schemas. + let isNullValue = anyValue is Void || (anyValue as? String) == nil + if isNullable && isNullValue { try addIfUnique(id: .string(""), caseName: context.safeNameGenerator.swiftMemberName(for: "")) } else { guard let rawValue = anyValue as? String else { From 0aa0187e4c62281b7cd8eda8321183ca695977fe Mon Sep 17 00:00:00 2001 From: Anton Titkov Date: Tue, 28 Oct 2025 16:39:01 +0300 Subject: [PATCH 5/5] Bump OpenAPIKit to 4.3.1 or greater --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index cdb703d6..7020b96b 100644 --- a/Package.swift +++ b/Package.swift @@ -45,7 +45,7 @@ let package = Package( .package(url: "https://github.com/apple/swift-collections", from: "1.1.4"), // Read OpenAPI documents - .package(url: "https://github.com/mattpolzin/OpenAPIKit", from: "4.0.0"), + .package(url: "https://github.com/mattpolzin/OpenAPIKit", from: "4.3.1"), .package(url: "https://github.com/jpsim/Yams", "5.1.0"..<"7.0.0"), // CLI Tool