Skip to content

Commit

Permalink
disambiguate a closure and add validations to document conversion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpolzin committed Aug 30, 2023
1 parent 0a94409 commit e9ced35
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/OpenAPIKitCompat/Compat30To31.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, OpenAPIKit.OpenAPI.Server.Variable> = variables.mapValues { variable in
let enumValue: [String]?
if !variable.enum.isEmpty {
enumValue = variable.enum
Expand Down
18 changes: 18 additions & 0 deletions Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e9ced35

Please sign in to comment.