From e9ced35c82c7d9256a09897dec06a99d672663f6 Mon Sep 17 00:00:00 2001 From: Matt Polzin Date: Wed, 30 Aug 2023 09:23:02 -0500 Subject: [PATCH] disambiguate a closure and add validations to document conversion tests --- Sources/OpenAPIKitCompat/Compat30To31.swift | 2 +- .../DocumentConversionTests.swift | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Sources/OpenAPIKitCompat/Compat30To31.swift b/Sources/OpenAPIKitCompat/Compat30To31.swift index b16b82c84..01cc8b4bb 100644 --- a/Sources/OpenAPIKitCompat/Compat30To31.swift +++ b/Sources/OpenAPIKitCompat/Compat30To31.swift @@ -86,7 +86,7 @@ extension OpenAPIKit30.OpenAPI.Server: To31 { /// to facilitate incremental migration within your codebase from OpenAPIKit30 to OpenAPIKit. public func to31() -> OpenAPIKit.OpenAPI.Server { - let newVariables = variables.mapValues { variable in + let newVariables: OrderedDictionary = variables.mapValues { variable in let enumValue: [String]? if !variable.enum.isEmpty { enumValue = variable.enum diff --git a/Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift b/Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift index c908b9965..f5401e17d 100644 --- a/Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift +++ b/Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift @@ -24,6 +24,8 @@ final class DocumentConversionTests: XCTestCase { try assertEqualNewToOld(newDoc, oldDoc) XCTAssertEqual(newDoc.openAPIVersion, .v3_1_0) + + try newDoc.validate() } func test_vendorExtensionsOnDoc() throws { @@ -39,6 +41,8 @@ final class DocumentConversionTests: XCTestCase { let newDoc = oldDoc.convert(to: .v3_1_0) try assertEqualNewToOld(newDoc, oldDoc) + + try newDoc.validate() } func test_fullInfo() throws { @@ -60,6 +64,8 @@ final class DocumentConversionTests: XCTestCase { let newDoc = oldDoc.convert(to: .v3_1_0) try assertEqualNewToOld(newDoc, oldDoc) + + try newDoc.validate() } func test_servers() throws { @@ -93,6 +99,8 @@ final class DocumentConversionTests: XCTestCase { let newDoc = oldDoc.convert(to: .v3_1_0) try assertEqualNewToOld(newDoc, oldDoc) + + try newDoc.validate() } func test_paths() throws { @@ -194,6 +202,8 @@ final class DocumentConversionTests: XCTestCase { let newDoc = oldDoc.convert(to: .v3_1_0) try assertEqualNewToOld(newDoc, oldDoc) + + try newDoc.validate() } func testJSONSchemas() throws { @@ -300,6 +310,8 @@ final class DocumentConversionTests: XCTestCase { let newDoc = oldDoc.convert(to: .v3_1_0) try assertEqualNewToOld(newDoc, oldDoc) + + try newDoc.validate() } func testSecurity() throws { @@ -330,6 +342,8 @@ final class DocumentConversionTests: XCTestCase { let newDoc2 = oldDoc2.convert(to: .v3_1_0) try assertEqualNewToOld(newDoc2, oldDoc2) + + try newDoc.validate() } func testTags() throws { @@ -371,6 +385,8 @@ final class DocumentConversionTests: XCTestCase { let newDoc3 = oldDoc3.convert(to: .v3_1_0) try assertEqualNewToOld(newDoc3, oldDoc3) + + try newDoc.validate() } func testExternalDocs() throws { @@ -405,6 +421,8 @@ final class DocumentConversionTests: XCTestCase { let newDoc = oldDoc.convert(to: .v3_1_0) try assertEqualNewToOld(newDoc, oldDoc) + + try newDoc.validate() } // TODO: more tests