diff --git a/README.md b/README.md index fdebfeaaf..07e427694 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ let encodedOpenAPIDoc = try encoder.encode(openAPIDoc) ### Validating OpenAPI Documents Thanks to Swift's type system, the vast majority of the OpenAPI Specification is represented by the types of OpenAPIKit -- you cannot create bad OpenAPI docuements in the first place and decoding a document will fail with generally useful errors. -That being said, there are a small number of additional checks that you can perform to really put any concerns to bed. +That being said, there are a small number of additional checks that you can perform to really put any concerns to rest. ```swift let openAPIDoc: OpenAPI.Document = ... diff --git a/Sources/OpenAPIKitCore/AnyCodable/AnyCodable.swift b/Sources/OpenAPIKitCore/AnyCodable/AnyCodable.swift index bcefa16db..8b86f9978 100644 --- a/Sources/OpenAPIKitCore/AnyCodable/AnyCodable.swift +++ b/Sources/OpenAPIKitCore/AnyCodable/AnyCodable.swift @@ -188,6 +188,8 @@ extension AnyCodable: Equatable { return lhs == rhs case let (lhs as String, rhs as String): return lhs == rhs + case let (lhs as URL, rhs as URL): + return lhs == rhs case let (lhs as [String: String], rhs as [String: String]): return lhs == rhs case let (lhs as [String: Int], rhs as [String: Int]): diff --git a/Tests/AnyCodableTests/AnyCodableTests.swift b/Tests/AnyCodableTests/AnyCodableTests.swift index e45618ceb..98f09913f 100644 --- a/Tests/AnyCodableTests/AnyCodableTests.swift +++ b/Tests/AnyCodableTests/AnyCodableTests.swift @@ -29,6 +29,7 @@ class AnyCodableTests: XCTestCase { XCTAssertEqual(AnyCodable(Float(2)), AnyCodable(Float(2))) XCTAssertEqual(AnyCodable(Double(2)), AnyCodable(Double(2))) XCTAssertEqual(AnyCodable("hi"), AnyCodable("hi")) + XCTAssertEqual(AnyCodable(URL(string: "file://./params/name.json")), AnyCodable(URL(string: "file://./params/name.json"))) XCTAssertEqual(AnyCodable(["hi": AnyCodable(2)]), AnyCodable(["hi": AnyCodable(2)])) XCTAssertEqual(AnyCodable([AnyCodable("hi"), AnyCodable("there")]), AnyCodable([AnyCodable("hi"), AnyCodable("there")])) XCTAssertEqual(AnyCodable(["hi":1]), AnyCodable(["hi":1]))