From 02f51055b2580aae44556700c778fcc5781f3e23 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Mon, 27 Jan 2025 19:36:30 -0600 Subject: [PATCH] fixing tests --- Tests/AnyCodableTests/AnyCodableTests.swift | 10 ++-- .../ComponentErrorTests.swift | 2 +- .../DocumentErrorTests.swift | 2 +- .../Helpers.swift | 2 +- .../JSONReferenceErrorTests.swift | 2 +- .../OperationErrorTests.swift | 2 +- .../PathsErrorTests.swift | 2 +- .../RequestContentMapErrorTests.swift | 2 +- .../RequestContentSchemaErrorTests.swift | 2 +- .../RequestErrorTests.swift | 2 +- .../ResponseErrorTests.swift | 2 +- .../SchemaErrorTests.swift | 2 +- .../SecuritySchemeErrorTests.swift | 2 +- .../GitHubAPITests.swift | 2 +- .../GoogleBooksAPITests.swift | 2 +- .../PetStoreAPITests.swift | 2 +- .../SwaggerDocSamplesTests.swift | 2 +- .../TomTomAPITests.swift | 2 +- Tests/OpenAPIKit30Tests/ComponentsTests.swift | 4 +- .../Content/ContentTests.swift | 8 +-- .../Document/DocumentInfoTests.swift | 12 ++-- .../Document/DocumentTests.swift | 4 +- .../ExternalDereferencingDocumentTests.swift | 2 +- .../Operation/OperationTests.swift | 6 +- .../Parameter/ParameterTests.swift | 4 +- .../Path Item/PathItemTests.swift | 4 +- .../Schema Object/JSONSchemaTests.swift | 60 +++++++++---------- .../Schema Object/SchemaObjectYamsTests.swift | 2 +- Tests/OpenAPIKit30Tests/ServerTests.swift | 4 +- Tests/OpenAPIKit30Tests/TestHelpers.swift | 2 +- .../Validator/ValidatorTests.swift | 48 +++++++-------- .../VendorExtendableTests.swift | 16 ++--- .../ComponentErrorTests.swift | 2 +- .../DocumentErrorTests.swift | 2 +- .../Helpers.swift | 2 +- .../JSONReferenceErrorTests.swift | 2 +- .../OperationErrorTests.swift | 2 +- .../PathsErrorTests.swift | 2 +- .../RequestContentMapErrorTests.swift | 2 +- .../RequestContentSchemaErrorTests.swift | 2 +- .../RequestErrorTests.swift | 2 +- .../ResponseErrorTests.swift | 2 +- .../SchemaErrorTests.swift | 2 +- .../SecuritySchemeErrorTests.swift | 2 +- .../TemplateAPITests.swift | 2 +- Tests/OpenAPIKitTests/ComponentsTests.swift | 4 +- .../Content/ContentTests.swift | 8 +-- .../Document/DocumentInfoTests.swift | 12 ++-- .../Document/DocumentTests.swift | 4 +- .../ExternalDereferencingDocumentTests.swift | 2 +- .../Operation/OperationTests.swift | 6 +- .../Parameter/ParameterTests.swift | 4 +- .../Path Item/PathItemTests.swift | 4 +- .../Schema Object/JSONSchemaTests.swift | 58 +++++++++--------- .../Schema Object/SchemaObjectYamsTests.swift | 2 +- Tests/OpenAPIKitTests/ServerTests.swift | 4 +- Tests/OpenAPIKitTests/TestHelpers.swift | 2 +- .../Validator/BuiltinValidationTests.swift | 8 +-- .../Validator/ValidatorTests.swift | 48 +++++++-------- .../VendorExtendableTests.swift | 16 ++--- .../OrderedDictionaryTests.swift | 2 +- 61 files changed, 215 insertions(+), 215 deletions(-) diff --git a/Tests/AnyCodableTests/AnyCodableTests.swift b/Tests/AnyCodableTests/AnyCodableTests.swift index 98f09913f..6dfde77c5 100644 --- a/Tests/AnyCodableTests/AnyCodableTests.swift +++ b/Tests/AnyCodableTests/AnyCodableTests.swift @@ -9,8 +9,8 @@ class AnyCodableTests: XCTestCase { let _: AnyCodable = 10 let _: AnyCodable = 3.4 let _: AnyCodable = "hello" - let _: AnyCodable = ["hi", "there"] - let _: AnyCodable = ["hi": "there"] + let _: AnyCodable = .init(["hi", "there"]) + let _: AnyCodable = .init(["hi": "there"]) } func testEquality() throws { @@ -153,12 +153,12 @@ class AnyCodableTests: XCTestCase { "boolean": true, "integer": 1, "string": "string", - "array": [1, 2, 3], - "nested": [ + "array": .init([1, 2, 3]), + "nested": .init([ "a": "alpha", "b": "bravo", "c": "charlie", - ], + ]), ] let result = try testStringFromEncoding(of: dictionary) diff --git a/Tests/OpenAPIKit30ErrorReportingTests/ComponentErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/ComponentErrorTests.swift index a33ed3ca0..53f247b55 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/ComponentErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/ComponentErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class ComponentErrorTests: XCTestCase { diff --git a/Tests/OpenAPIKit30ErrorReportingTests/DocumentErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/DocumentErrorTests.swift index ef2b434b6..919c52132 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/DocumentErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/DocumentErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class DocumentErrorTests: XCTestCase { diff --git a/Tests/OpenAPIKit30ErrorReportingTests/Helpers.swift b/Tests/OpenAPIKit30ErrorReportingTests/Helpers.swift index f067827ec..2a3cb4e13 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/Helpers.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/Helpers.swift @@ -6,6 +6,6 @@ // import Foundation -import Yams +@preconcurrency import Yams let testDecoder = YAMLDecoder() diff --git a/Tests/OpenAPIKit30ErrorReportingTests/JSONReferenceErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/JSONReferenceErrorTests.swift index a35f01cc4..e6acb4d05 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/JSONReferenceErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/JSONReferenceErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class JSONReferenceErrorTests: XCTestCase { func test_referenceFailedToParse() { diff --git a/Tests/OpenAPIKit30ErrorReportingTests/OperationErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/OperationErrorTests.swift index 805273faa..94f876bb6 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/OperationErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/OperationErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class OperationErrorTests: XCTestCase { func test_missingResponses() { diff --git a/Tests/OpenAPIKit30ErrorReportingTests/PathsErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/PathsErrorTests.swift index c69c553cd..bba441e24 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/PathsErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/PathsErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class PathsErrorTests: XCTestCase { func test_missingPaths() { diff --git a/Tests/OpenAPIKit30ErrorReportingTests/RequestContentMapErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/RequestContentMapErrorTests.swift index c68ba6bf7..75ac121c0 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/RequestContentMapErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/RequestContentMapErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class RequestContentMapErrorTests: XCTestCase { /** diff --git a/Tests/OpenAPIKit30ErrorReportingTests/RequestContentSchemaErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/RequestContentSchemaErrorTests.swift index 45ec737d3..6aec769f8 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/RequestContentSchemaErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/RequestContentSchemaErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class RequestContentSchemaErrorTests: XCTestCase { func test_wrongTypeContentSchemaTypeProperty() { diff --git a/Tests/OpenAPIKit30ErrorReportingTests/RequestErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/RequestErrorTests.swift index 0289fc510..6cb3a10c4 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/RequestErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/RequestErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class RequestErrorTests: XCTestCase { func test_wrongTypeRequest() { diff --git a/Tests/OpenAPIKit30ErrorReportingTests/ResponseErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/ResponseErrorTests.swift index 59c33d57a..2d7552afd 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/ResponseErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/ResponseErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class ResponseErrorTests: XCTestCase { func test_headerWithContentAndSchema() { diff --git a/Tests/OpenAPIKit30ErrorReportingTests/SchemaErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/SchemaErrorTests.swift index 90f2b197d..3667ed4fc 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/SchemaErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/SchemaErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class SchemaErrorTests: XCTestCase { func test_nonIntegerMaximumForIntegerSchema() { diff --git a/Tests/OpenAPIKit30ErrorReportingTests/SecuritySchemeErrorTests.swift b/Tests/OpenAPIKit30ErrorReportingTests/SecuritySchemeErrorTests.swift index 59989c334..ab03977fc 100644 --- a/Tests/OpenAPIKit30ErrorReportingTests/SecuritySchemeErrorTests.swift +++ b/Tests/OpenAPIKit30ErrorReportingTests/SecuritySchemeErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class SecuritySchemeErrorTests: XCTestCase { func test_missingSecuritySchemeError() { diff --git a/Tests/OpenAPIKit30RealSpecSuite/GitHubAPITests.swift b/Tests/OpenAPIKit30RealSpecSuite/GitHubAPITests.swift index b0d0229f5..3a23f3c1a 100644 --- a/Tests/OpenAPIKit30RealSpecSuite/GitHubAPITests.swift +++ b/Tests/OpenAPIKit30RealSpecSuite/GitHubAPITests.swift @@ -7,7 +7,7 @@ import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams import Foundation #if canImport(FoundationNetworking) import FoundationNetworking diff --git a/Tests/OpenAPIKit30RealSpecSuite/GoogleBooksAPITests.swift b/Tests/OpenAPIKit30RealSpecSuite/GoogleBooksAPITests.swift index 6dd077c22..76ccce43e 100644 --- a/Tests/OpenAPIKit30RealSpecSuite/GoogleBooksAPITests.swift +++ b/Tests/OpenAPIKit30RealSpecSuite/GoogleBooksAPITests.swift @@ -7,7 +7,7 @@ import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams import Foundation #if canImport(FoundationNetworking) import FoundationNetworking diff --git a/Tests/OpenAPIKit30RealSpecSuite/PetStoreAPITests.swift b/Tests/OpenAPIKit30RealSpecSuite/PetStoreAPITests.swift index d33d12aa8..c0ee2a65b 100644 --- a/Tests/OpenAPIKit30RealSpecSuite/PetStoreAPITests.swift +++ b/Tests/OpenAPIKit30RealSpecSuite/PetStoreAPITests.swift @@ -7,7 +7,7 @@ import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams import Foundation #if canImport(FoundationNetworking) import FoundationNetworking diff --git a/Tests/OpenAPIKit30RealSpecSuite/SwaggerDocSamplesTests.swift b/Tests/OpenAPIKit30RealSpecSuite/SwaggerDocSamplesTests.swift index 1344f66b9..c4455dd69 100644 --- a/Tests/OpenAPIKit30RealSpecSuite/SwaggerDocSamplesTests.swift +++ b/Tests/OpenAPIKit30RealSpecSuite/SwaggerDocSamplesTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class SwaggerDocSamplesTests: XCTestCase { func test_allOfExample() throws { diff --git a/Tests/OpenAPIKit30RealSpecSuite/TomTomAPITests.swift b/Tests/OpenAPIKit30RealSpecSuite/TomTomAPITests.swift index 00e338422..1f717e23f 100644 --- a/Tests/OpenAPIKit30RealSpecSuite/TomTomAPITests.swift +++ b/Tests/OpenAPIKit30RealSpecSuite/TomTomAPITests.swift @@ -7,7 +7,7 @@ import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams import Foundation #if canImport(FoundationNetworking) import FoundationNetworking diff --git a/Tests/OpenAPIKit30Tests/ComponentsTests.swift b/Tests/OpenAPIKit30Tests/ComponentsTests.swift index 957ebcb2e..bbdd577a7 100644 --- a/Tests/OpenAPIKit30Tests/ComponentsTests.swift +++ b/Tests/OpenAPIKit30Tests/ComponentsTests.swift @@ -309,7 +309,7 @@ extension ComponentsTests { ) ] ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encoded = try orderUnstableTestStringFromEncoding(of: t1) @@ -504,7 +504,7 @@ extension ComponentsTests { ) ] ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKit30Tests/Content/ContentTests.swift b/Tests/OpenAPIKit30Tests/Content/ContentTests.swift index b6c92b549..5d5ee4671 100644 --- a/Tests/OpenAPIKit30Tests/Content/ContentTests.swift +++ b/Tests/OpenAPIKit30Tests/Content/ContentTests.swift @@ -205,7 +205,7 @@ extension ContentTests { func test_exampleAndSchemaContent_encode() { let content = OpenAPI.Content(schema: .init(.object(properties: ["hello": .string])), - example: [ "hello": "world" ]) + example: .init([ "hello": "world" ])) let encodedContent = try! orderUnstableTestStringFromEncoding(of: content) assertJSONEquivalent( @@ -260,7 +260,7 @@ extension ContentTests { func test_examplesAndSchemaContent_encode() { let content = OpenAPI.Content(schema: .init(.object(properties: ["hello": .string])), - examples: ["hello": .b(OpenAPI.Example(value: .init([ "hello": "world" ])))]) + examples: ["hello": .b(OpenAPI.Example(value: .init(.init([ "hello": "world" ]))))]) let encodedContent = try! orderUnstableTestStringFromEncoding(of: content) assertJSONEquivalent( @@ -405,7 +405,7 @@ extension ContentTests { func test_vendorExtensions_encode() { let content = OpenAPI.Content( schema: .init(.string), - vendorExtensions: [ "x-hello": [ "world": 123 ] ] + vendorExtensions: [ "x-hello": .init([ "world": 123 ]) ] ) let encodedContent = try! orderUnstableTestStringFromEncoding(of: content) @@ -428,7 +428,7 @@ extension ContentTests { func test_vendorExtensions_encode_fixKey() { let content = OpenAPI.Content( schema: .init(.string), - vendorExtensions: [ "hello": [ "world": 123 ] ] + vendorExtensions: [ "hello": .init([ "world": 123 ]) ] ) let encodedContent = try! orderUnstableTestStringFromEncoding(of: content) diff --git a/Tests/OpenAPIKit30Tests/Document/DocumentInfoTests.swift b/Tests/OpenAPIKit30Tests/Document/DocumentInfoTests.swift index 4483be005..9533de090 100644 --- a/Tests/OpenAPIKit30Tests/Document/DocumentInfoTests.swift +++ b/Tests/OpenAPIKit30Tests/Document/DocumentInfoTests.swift @@ -103,7 +103,7 @@ extension DocumentInfoTests { let license = OpenAPI.Document.Info.License( name: "MIT", url: URL(string: "http://website.com")!, - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedLicense = try orderUnstableTestStringFromEncoding(of: license) @@ -142,7 +142,7 @@ extension DocumentInfoTests { OpenAPI.Document.Info.License( name: "MIT", url: URL(string: "http://website.com")!, - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } @@ -240,7 +240,7 @@ extension DocumentInfoTests { func test_contact_vendorExtensions_encode() throws { let contact = OpenAPI.Document.Info.Contact( email: "email", - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedContact = try orderUnstableTestStringFromEncoding(of: contact) @@ -276,7 +276,7 @@ extension DocumentInfoTests { contact, .init( email: "email", - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } @@ -508,7 +508,7 @@ extension DocumentInfoTests { title: "title", license: .init(name: "license"), version: "1.0", - vendorExtensions: ["x-speacialFeature": ["hello", "world"]] + vendorExtensions: ["x-speacialFeature": .init(["hello", "world"])] ) let encodedInfo = try orderUnstableTestStringFromEncoding(of: info) @@ -554,7 +554,7 @@ extension DocumentInfoTests { title: "title", license: .init(name: "license"), version: "1.0", - vendorExtensions: ["x-speacialFeature": ["hello", "world"]] + vendorExtensions: ["x-speacialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKit30Tests/Document/DocumentTests.swift b/Tests/OpenAPIKit30Tests/Document/DocumentTests.swift index ccf4d2c55..d46d29b52 100644 --- a/Tests/OpenAPIKit30Tests/Document/DocumentTests.swift +++ b/Tests/OpenAPIKit30Tests/Document/DocumentTests.swift @@ -844,7 +844,7 @@ extension DocumentTests { paths: [:], components: .noComponents, externalDocs: .init(url: URL(string: "http://google.com")!), - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedDocument = try orderUnstableTestStringFromEncoding(of: document) @@ -903,7 +903,7 @@ extension DocumentTests { paths: [:], components: .noComponents, externalDocs: .init(url: URL(string: "http://google.com")!), - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKit30Tests/Document/ExternalDereferencingDocumentTests.swift b/Tests/OpenAPIKit30Tests/Document/ExternalDereferencingDocumentTests.swift index d9863a92c..00af97ac5 100644 --- a/Tests/OpenAPIKit30Tests/Document/ExternalDereferencingDocumentTests.swift +++ b/Tests/OpenAPIKit30Tests/Document/ExternalDereferencingDocumentTests.swift @@ -3,7 +3,7 @@ // import Foundation -import Yams +@preconcurrency import Yams import OpenAPIKit30 import XCTest diff --git a/Tests/OpenAPIKit30Tests/Operation/OperationTests.swift b/Tests/OpenAPIKit30Tests/Operation/OperationTests.swift index a09c535d7..f773beabc 100644 --- a/Tests/OpenAPIKit30Tests/Operation/OperationTests.swift +++ b/Tests/OpenAPIKit30Tests/Operation/OperationTests.swift @@ -7,7 +7,7 @@ import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class OperationTests: XCTestCase { func test_init() { @@ -126,7 +126,7 @@ extension OperationTests { deprecated: true, security: [[.component(named: "security"): []]], servers: [.init(url: URL(string: "https://google.com")!)], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedOperation = try orderUnstableTestStringFromEncoding(of: operation) @@ -298,7 +298,7 @@ extension OperationTests { deprecated: true, security: [[.component(named: "security"): []]], servers: [.init(url: URL(string: "https://google.com")!)], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) diff --git a/Tests/OpenAPIKit30Tests/Parameter/ParameterTests.swift b/Tests/OpenAPIKit30Tests/Parameter/ParameterTests.swift index 5a263a46d..58e28d611 100644 --- a/Tests/OpenAPIKit30Tests/Parameter/ParameterTests.swift +++ b/Tests/OpenAPIKit30Tests/Parameter/ParameterTests.swift @@ -827,7 +827,7 @@ extension ParameterTests { context: .path, schema: .string, description: "world", - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedParameter = try orderUnstableTestStringFromEncoding(of: parameter) @@ -880,7 +880,7 @@ extension ParameterTests { context: .path, schema: .string, description: "world", - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKit30Tests/Path Item/PathItemTests.swift b/Tests/OpenAPIKit30Tests/Path Item/PathItemTests.swift index aee98705d..7a03c7578 100644 --- a/Tests/OpenAPIKit30Tests/Path Item/PathItemTests.swift +++ b/Tests/OpenAPIKit30Tests/Path Item/PathItemTests.swift @@ -175,7 +175,7 @@ extension PathItemTests { description: "description", servers: [OpenAPI.Server(url: URL(string: "http://google.com")!)], parameters: [.parameter(name: "hello", context: .query, schema: .string)], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedPathItem = try orderUnstableTestStringFromEncoding(of: pathItem) @@ -245,7 +245,7 @@ extension PathItemTests { description: "description", servers: [OpenAPI.Server(url: URL(string: "http://google.com")!)], parameters: [.parameter(name: "hello", context: .query, schema: .string)], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKit30Tests/Schema Object/JSONSchemaTests.swift b/Tests/OpenAPIKit30Tests/Schema Object/JSONSchemaTests.swift index 18dda979f..8d5319e63 100644 --- a/Tests/OpenAPIKit30Tests/Schema Object/JSONSchemaTests.swift +++ b/Tests/OpenAPIKit30Tests/Schema Object/JSONSchemaTests.swift @@ -1057,15 +1057,15 @@ final class SchemaObjectTests: XCTestCase { func test_withInitalAllowedValues() { let boolean = JSONSchema.boolean(.init(format: .unspecified, required: true, allowedValues: [false])) - let object = JSONSchema.object(.init(format: .unspecified, required: true, allowedValues: [[:]]), .init(properties: [:])) - let array = JSONSchema.array(.init(format: .unspecified, required: true, allowedValues: [[false]]), .init(items: .boolean(.init(format: .unspecified, required: true)))) + let object = JSONSchema.object(.init(format: .unspecified, required: true, allowedValues: [.init([:])]), .init(properties: [:])) + let array = JSONSchema.array(.init(format: .unspecified, required: true, allowedValues: [.init([false])]), .init(items: .boolean(.init(format: .unspecified, required: true)))) let number = JSONSchema.number(.init(format: .unspecified, required: true, allowedValues: [2.5]), .init()) let integer = JSONSchema.integer(.init(format: .unspecified, required: true, allowedValues: [5]), .init()) let string = JSONSchema.string(.init(format: .unspecified, required: true, allowedValues: ["hello"]), .init()) let fragment = JSONSchema.fragment(.init(allowedValues: [false])) XCTAssertEqual(boolean.allowedValues, [false]) - XCTAssertEqual(object.allowedValues, [[:]]) + XCTAssertEqual(object.allowedValues, [.init([:])]) XCTAssertEqual(array.allowedValues?[0].value as! [Bool], [false]) XCTAssertEqual(number.allowedValues, [2.5]) XCTAssertEqual(integer.allowedValues, [5]) @@ -1077,9 +1077,9 @@ final class SchemaObjectTests: XCTestCase { let boolean = JSONSchema.boolean(.init(format: .unspecified, required: true)) .with(allowedValues: [false]) let object = JSONSchema.object(.init(format: .unspecified, required: true), .init(properties: [:])) - .with(allowedValues: [[:]]) + .with(allowedValues: [.init([:])]) let array = JSONSchema.array(.init(format: .unspecified, required: true), .init(items: .boolean(.init(format: .unspecified, required: true)))) - .with(allowedValues: [[false]]) + .with(allowedValues: [.init([false])]) let number = JSONSchema.number(.init(format: .unspecified, required: true), .init()) .with(allowedValues: [2.5]) let integer = JSONSchema.integer(.init(format: .unspecified, required: true), .init()) @@ -1118,16 +1118,16 @@ final class SchemaObjectTests: XCTestCase { func test_withInitalDefaultValue() { let boolean = JSONSchema.boolean(.init(format: .unspecified, required: true, defaultValue: false)) - let object = JSONSchema.object(.init(format: .unspecified, required: true, defaultValue: [:]), .init(properties: [:])) - let array = JSONSchema.array(.init(format: .unspecified, required: true, defaultValue: [false]), .init(items: .boolean(.init(format: .unspecified, required: true)))) + let object = JSONSchema.object(.init(format: .unspecified, required: true, defaultValue: .init([:])), .init(properties: [:])) + let array = JSONSchema.array(.init(format: .unspecified, required: true, defaultValue: .init([false])), .init(items: .boolean(.init(format: .unspecified, required: true)))) let number = JSONSchema.number(.init(format: .unspecified, required: true, defaultValue: 2.5), .init()) let integer = JSONSchema.integer(.init(format: .unspecified, required: true, defaultValue: 5), .init()) let string = JSONSchema.string(.init(format: .unspecified, required: true, defaultValue: "hello"), .init()) let fragment = JSONSchema.fragment(.init(defaultValue: false)) XCTAssertEqual(boolean.defaultValue, false) - XCTAssertEqual(object.defaultValue, [:]) - XCTAssertEqual(array.defaultValue, [false]) + XCTAssertEqual(object.defaultValue, .init([:])) + XCTAssertEqual(array.defaultValue, .init([false])) XCTAssertEqual(number.defaultValue, 2.5) XCTAssertEqual(integer.defaultValue, 5) XCTAssertEqual(string.defaultValue, "hello") @@ -1138,9 +1138,9 @@ final class SchemaObjectTests: XCTestCase { let boolean = JSONSchema.boolean(.init(format: .unspecified, required: true)) .with(defaultValue: false) let object = JSONSchema.object(.init(format: .unspecified, required: true), .init(properties: [:])) - .with(defaultValue: [:]) + .with(defaultValue: .init([:])) let array = JSONSchema.array(.init(format: .unspecified, required: true), .init(items: .boolean(.init(format: .unspecified, required: true)))) - .with(defaultValue: [false]) + .with(defaultValue: .init([false])) let number = JSONSchema.number(.init(format: .unspecified, required: true), .init()) .with(defaultValue: 2.5) let integer = JSONSchema.integer(.init(format: .unspecified, required: true), .init()) @@ -1163,7 +1163,7 @@ final class SchemaObjectTests: XCTestCase { XCTAssertEqual(boolean.defaultValue, false) XCTAssertEqual(object.defaultValue, AnyCodable([String: String]())) - XCTAssertEqual(array.defaultValue, [false]) + XCTAssertEqual(array.defaultValue, .init([false])) XCTAssertEqual(number.defaultValue, 2.5) XCTAssertEqual(integer.defaultValue, 5) XCTAssertEqual(string.defaultValue, "hello") @@ -1178,7 +1178,7 @@ final class SchemaObjectTests: XCTestCase { } func test_withInitialExample() { - let object = JSONSchema.object(.init(format: .unspecified, required: true, example: [:]), .init(properties: [:])) + let object = JSONSchema.object(.init(format: .unspecified, required: true, example: .init([:])), .init(properties: [:])) let fragment = JSONSchema.fragment(.init(example: "hi")) // nonsense @@ -1202,7 +1202,7 @@ final class SchemaObjectTests: XCTestCase { let object = try JSONSchema.object(.init(format: .unspecified, required: true), .init(properties: [:])) .with(example: AnyCodable([String: String]())) let array = try JSONSchema.array(.init(), .init()) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let boolean = try JSONSchema.boolean(.init(format: .unspecified, required: true)) .with(example: true) @@ -1216,17 +1216,17 @@ final class SchemaObjectTests: XCTestCase { .with(example: "hello world") let allOf = try JSONSchema.all(of: [.string(.init(), .init())]) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let anyOf = try JSONSchema.any(of: [object]) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let oneOf = try JSONSchema.one(of: [object]) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let not = try JSONSchema.not(object) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let fragment = try JSONSchema.fragment(.init()).with(example: "hi") XCTAssertThrowsError(try JSONSchema.reference(.external(URL(string: "hello/world.json#/hello")!)) - .with(example: ["hello"])) + .with(example: .init(["hello"]))) XCTAssertEqual(object.example?.value as? [String: String], [:]) XCTAssertEqual(array.example?.value as? [String], ["hello"]) @@ -1812,7 +1812,7 @@ extension SchemaObjectTests { XCTAssertEqual(deprecatedObject, JSONSchema.object(.init(format: .generic, deprecated: true), .init(properties: [:]))) XCTAssertEqual(allowedValueObject.allowedValues?[0].value as! [String: Bool], ["hello": false]) XCTAssertEqual(allowedValueObject.jsonTypeFormat, .object(.generic)) - XCTAssertEqual(defaultValueObject.defaultValue, ["hello": false]) + XCTAssertEqual(defaultValueObject.defaultValue, .init(["hello": false])) XCTAssertEqual(discriminatorObject, JSONSchema.object(discriminator: .init(propertyName: "hello"))) guard case let .object(_, contextB) = allowedValueObject.value else { @@ -2749,7 +2749,7 @@ extension SchemaObjectTests { XCTAssertEqual(nullableObject, JSONSchema.object(.init(format: .generic, nullable: true, example: AnyCodable(["hello": true])), .init(properties: [:]))) XCTAssertEqual(allowedValueObject.allowedValues?[0].value as! [String: Bool], ["hello": false]) XCTAssertEqual(allowedValueObject.jsonTypeFormat, .object(.generic)) - XCTAssertEqual(allowedValueObject.example, ["hello" : true]) + XCTAssertEqual(allowedValueObject.example, .init(["hello" : true])) guard case let .object(_, contextB) = allowedValueObject.value else { XCTFail("expected object to be parsed as object") @@ -3137,9 +3137,9 @@ extension SchemaObjectTests { let writeOnlyArray = JSONSchema.array(.init(format: .unspecified, required: true, permissions: .writeOnly), .init()) let deprecatedArray = JSONSchema.array(.init(format: .unspecified, required: true, deprecated: true), .init()) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init()) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) let defaultValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init()) - .with(defaultValue: [10]) + .with(defaultValue: .init([10])) let discriminatorArray = JSONSchema.array(.init(format: .unspecified, required: true, discriminator: .init(propertyName: "hello")), .init()) testAllSharedSimpleContextEncoding( @@ -3190,7 +3190,7 @@ extension SchemaObjectTests { XCTAssertEqual(writeOnlyArray, JSONSchema.array(.init(format: .generic, permissions: .writeOnly), .init())) XCTAssertEqual(deprecatedArray, JSONSchema.array(.init(format: .generic, deprecated: true), .init())) XCTAssertEqual(allowedValueArray.allowedValues?[0].value as! [Bool], [false]) - XCTAssertEqual(defaultValueArray.defaultValue, [false]) + XCTAssertEqual(defaultValueArray.defaultValue, .init([false])) XCTAssertEqual(discriminatorArray, JSONSchema.array(discriminator: .init(propertyName: "hello"))) guard case let .array(_, contextB) = allowedValueArray.value else { @@ -3223,7 +3223,7 @@ extension SchemaObjectTests { let optionalArray = JSONSchema.array(.init(format: .unspecified, required: false), .init(items: .boolean(.init(format: .unspecified, required: false)))) let nullableArray = JSONSchema.array(.init(format: .unspecified, required: true, nullable: true), .init(items: .boolean(.init(format: .unspecified, required: false)))) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init(items: .boolean(.init(format: .unspecified, required: false)))) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) testEncodingPropertyLines(entity: requiredArray, propertyLines: [ @@ -3301,7 +3301,7 @@ extension SchemaObjectTests { let optionalArray = JSONSchema.array(.init(format: .unspecified, required: false), .init(uniqueItems: true)) let nullableArray = JSONSchema.array(.init(format: .unspecified, required: true, nullable: true), .init(uniqueItems: true)) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init(uniqueItems: true)) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) testEncodingPropertyLines( entity: requiredArray, @@ -3371,7 +3371,7 @@ extension SchemaObjectTests { let optionalArray = JSONSchema.array(.init(format: .unspecified, required: false), .init(maxItems: 2)) let nullableArray = JSONSchema.array(.init(format: .unspecified, required: true, nullable: true), .init(maxItems: 2)) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init(maxItems: 2)) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) testEncodingPropertyLines(entity: requiredArray, propertyLines: [ @@ -3429,7 +3429,7 @@ extension SchemaObjectTests { let optionalArray = JSONSchema.array(.init(format: .unspecified, required: false), .init(minItems: 2)) let nullableArray = JSONSchema.array(.init(format: .unspecified, required: true, nullable: true), .init(minItems: 2)) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init(minItems: 2)) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) testEncodingPropertyLines(entity: requiredArray, propertyLines: [ @@ -5955,8 +5955,8 @@ extension SchemaObjectTests { "hello": .boolean ], allowedValues: [ - [ "hello": true], - [ "hello": false] + .init([ "hello": true]), + .init([ "hello": false]) ] ) let addProp1 = JSONSchema.object( diff --git a/Tests/OpenAPIKit30Tests/Schema Object/SchemaObjectYamsTests.swift b/Tests/OpenAPIKit30Tests/Schema Object/SchemaObjectYamsTests.swift index 0528c0811..b191ea907 100644 --- a/Tests/OpenAPIKit30Tests/Schema Object/SchemaObjectYamsTests.swift +++ b/Tests/OpenAPIKit30Tests/Schema Object/SchemaObjectYamsTests.swift @@ -13,7 +13,7 @@ import Foundation import XCTest import OpenAPIKit30 -import Yams +@preconcurrency import Yams final class SchemaObjectYamsTests: XCTestCase { func test_floatingPointWholeNumberIntegerDecode() throws { diff --git a/Tests/OpenAPIKit30Tests/ServerTests.swift b/Tests/OpenAPIKit30Tests/ServerTests.swift index ac9638575..0b670697e 100644 --- a/Tests/OpenAPIKit30Tests/ServerTests.swift +++ b/Tests/OpenAPIKit30Tests/ServerTests.swift @@ -170,7 +170,7 @@ extension ServerTests { vendorExtensions: [ "x-otherThing": 1234 ] ) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } @@ -187,7 +187,7 @@ extension ServerTests { vendorExtensions: [ "x-otherThing": 1234 ] ) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedServer = try orderUnstableTestStringFromEncoding(of: server) diff --git a/Tests/OpenAPIKit30Tests/TestHelpers.swift b/Tests/OpenAPIKit30Tests/TestHelpers.swift index eadd92726..336866d5d 100644 --- a/Tests/OpenAPIKit30Tests/TestHelpers.swift +++ b/Tests/OpenAPIKit30Tests/TestHelpers.swift @@ -6,7 +6,7 @@ // import Foundation -import Yams +@preconcurrency import Yams import XCTest fileprivate let foundationTestEncoder = { () -> JSONEncoder in diff --git a/Tests/OpenAPIKit30Tests/Validator/ValidatorTests.swift b/Tests/OpenAPIKit30Tests/Validator/ValidatorTests.swift index 7ccf0caee..bc3d4555d 100644 --- a/Tests/OpenAPIKit30Tests/Validator/ValidatorTests.swift +++ b/Tests/OpenAPIKit30Tests/Validator/ValidatorTests.swift @@ -85,7 +85,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -112,7 +112,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -144,7 +144,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -180,7 +180,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -212,7 +212,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -242,7 +242,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -278,7 +278,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -312,7 +312,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -324,7 +324,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -360,7 +360,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -396,7 +396,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -433,7 +433,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -470,7 +470,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -506,7 +506,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -688,7 +688,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -722,7 +722,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -818,7 +818,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -869,7 +869,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -920,7 +920,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -958,7 +958,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -1002,7 +1002,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -1045,7 +1045,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -1335,7 +1335,7 @@ final class ValidatorTests: XCTestCase { vendorExtensions: [ "x-string": "hiya", "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]), "x-float": AnyCodable(22.5 as Float), "x-bool": true @@ -1373,7 +1373,7 @@ final class ValidatorTests: XCTestCase { vendorExtensions: [ "x-string": "hiya", "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]), "x-float": AnyCodable(22.5 as Float), "x-bool": true diff --git a/Tests/OpenAPIKit30Tests/VendorExtendableTests.swift b/Tests/OpenAPIKit30Tests/VendorExtendableTests.swift index 35cfa9e65..229621c29 100644 --- a/Tests/OpenAPIKit30Tests/VendorExtendableTests.swift +++ b/Tests/OpenAPIKit30Tests/VendorExtendableTests.swift @@ -39,13 +39,13 @@ final class VendorExtendableTests: XCTestCase { func test_encodeSuccess() throws { let test = TestStruct(vendorExtensions: [ "x-tension": "hello", - "x-two": [ + "x-two": .init([ "cool", "beans" - ], - "x-three": [ + ]), + "x-three": .init([ "nested": 10 - ] + ]) ]) let _ = try JSONEncoder().encode(test) @@ -85,13 +85,13 @@ extension VendorExtendableTests { func test_encode() throws { let test = TestStruct(vendorExtensions: [ "x-tension": "hello", - "x-two": [ + "x-two": .init([ "cool", "beans" - ], - "x-three": [ + ]), + "x-three": .init([ "nested": 10 - ] + ]) ]) let encoded = try orderUnstableTestStringFromEncoding(of: test) diff --git a/Tests/OpenAPIKitErrorReportingTests/ComponentErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/ComponentErrorTests.swift index 3c3f726e2..60e010320 100644 --- a/Tests/OpenAPIKitErrorReportingTests/ComponentErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/ComponentErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class ComponentErrorTests: XCTestCase { diff --git a/Tests/OpenAPIKitErrorReportingTests/DocumentErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/DocumentErrorTests.swift index 25ac8ba44..9d3a03d26 100644 --- a/Tests/OpenAPIKitErrorReportingTests/DocumentErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/DocumentErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class DocumentErrorTests: XCTestCase { diff --git a/Tests/OpenAPIKitErrorReportingTests/Helpers.swift b/Tests/OpenAPIKitErrorReportingTests/Helpers.swift index f067827ec..2a3cb4e13 100644 --- a/Tests/OpenAPIKitErrorReportingTests/Helpers.swift +++ b/Tests/OpenAPIKitErrorReportingTests/Helpers.swift @@ -6,6 +6,6 @@ // import Foundation -import Yams +@preconcurrency import Yams let testDecoder = YAMLDecoder() diff --git a/Tests/OpenAPIKitErrorReportingTests/JSONReferenceErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/JSONReferenceErrorTests.swift index 413df97d6..66167bd49 100644 --- a/Tests/OpenAPIKitErrorReportingTests/JSONReferenceErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/JSONReferenceErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class JSONReferenceErrorTests: XCTestCase { func test_referenceFailedToParse() { diff --git a/Tests/OpenAPIKitErrorReportingTests/OperationErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/OperationErrorTests.swift index 1743af2ac..d7e0129e2 100644 --- a/Tests/OpenAPIKitErrorReportingTests/OperationErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/OperationErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class OperationErrorTests: XCTestCase { func test_wrongTypeTags() { diff --git a/Tests/OpenAPIKitErrorReportingTests/PathsErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/PathsErrorTests.swift index 69ccb32da..e5dd3b760 100644 --- a/Tests/OpenAPIKitErrorReportingTests/PathsErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/PathsErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class PathsErrorTests: XCTestCase { func test_badPathReference() { diff --git a/Tests/OpenAPIKitErrorReportingTests/RequestContentMapErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/RequestContentMapErrorTests.swift index 6bc8a6ef2..685b52402 100644 --- a/Tests/OpenAPIKitErrorReportingTests/RequestContentMapErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/RequestContentMapErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class RequestContentMapErrorTests: XCTestCase { /** diff --git a/Tests/OpenAPIKitErrorReportingTests/RequestContentSchemaErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/RequestContentSchemaErrorTests.swift index e6217bfb4..17690166d 100644 --- a/Tests/OpenAPIKitErrorReportingTests/RequestContentSchemaErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/RequestContentSchemaErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class RequestContentSchemaErrorTests: XCTestCase { func test_wrongTypeContentSchemaTypeProperty() { diff --git a/Tests/OpenAPIKitErrorReportingTests/RequestErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/RequestErrorTests.swift index b8edd5b00..184349ee6 100644 --- a/Tests/OpenAPIKitErrorReportingTests/RequestErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/RequestErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class RequestErrorTests: XCTestCase { func test_wrongTypeRequest() { diff --git a/Tests/OpenAPIKitErrorReportingTests/ResponseErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/ResponseErrorTests.swift index 91332e3e7..99323a737 100644 --- a/Tests/OpenAPIKitErrorReportingTests/ResponseErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/ResponseErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class ResponseErrorTests: XCTestCase { func test_headerWithContentAndSchema() { diff --git a/Tests/OpenAPIKitErrorReportingTests/SchemaErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/SchemaErrorTests.swift index cc344e148..ede89a305 100644 --- a/Tests/OpenAPIKitErrorReportingTests/SchemaErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/SchemaErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class SchemaErrorTests: XCTestCase { func test_nonIntegerMaximumForIntegerSchema() { diff --git a/Tests/OpenAPIKitErrorReportingTests/SecuritySchemeErrorTests.swift b/Tests/OpenAPIKitErrorReportingTests/SecuritySchemeErrorTests.swift index 5e26ad145..f5f2e2081 100644 --- a/Tests/OpenAPIKitErrorReportingTests/SecuritySchemeErrorTests.swift +++ b/Tests/OpenAPIKitErrorReportingTests/SecuritySchemeErrorTests.swift @@ -8,7 +8,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class SecuritySchemeErrorTests: XCTestCase { func test_missingSecuritySchemeError() { diff --git a/Tests/OpenAPIKitRealSpecSuite/TemplateAPITests.swift b/Tests/OpenAPIKitRealSpecSuite/TemplateAPITests.swift index c9dd6ebff..bfbda7d5d 100644 --- a/Tests/OpenAPIKitRealSpecSuite/TemplateAPITests.swift +++ b/Tests/OpenAPIKitRealSpecSuite/TemplateAPITests.swift @@ -17,7 +17,7 @@ import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams import Foundation #if canImport(FoundationNetworking) import FoundationNetworking diff --git a/Tests/OpenAPIKitTests/ComponentsTests.swift b/Tests/OpenAPIKitTests/ComponentsTests.swift index bf1f7e776..00c5b10bd 100644 --- a/Tests/OpenAPIKitTests/ComponentsTests.swift +++ b/Tests/OpenAPIKitTests/ComponentsTests.swift @@ -319,7 +319,7 @@ extension ComponentsTests { pathItems: [ "ten": .init(get: .init(responses: [200: .response(description: "response")])) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encoded = try orderUnstableTestStringFromEncoding(of: t1) @@ -541,7 +541,7 @@ extension ComponentsTests { pathItems: [ "ten": .init(get: .init(responses: [200: .response(description: "response")])) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKitTests/Content/ContentTests.swift b/Tests/OpenAPIKitTests/Content/ContentTests.swift index 300bf67ee..583cc44b0 100644 --- a/Tests/OpenAPIKitTests/Content/ContentTests.swift +++ b/Tests/OpenAPIKitTests/Content/ContentTests.swift @@ -205,7 +205,7 @@ extension ContentTests { func test_exampleAndSchemaContent_encode() { let content = OpenAPI.Content(schema: .init(.object(properties: ["hello": .string])), - example: [ "hello": "world" ]) + example: .init([ "hello": "world" ])) let encodedContent = try! orderUnstableTestStringFromEncoding(of: content) assertJSONEquivalent( @@ -260,7 +260,7 @@ extension ContentTests { func test_examplesAndSchemaContent_encode() { let content = OpenAPI.Content(schema: .init(.object(properties: ["hello": .string])), - examples: ["hello": .b(OpenAPI.Example(value: .init([ "hello": "world" ])))]) + examples: ["hello": .b(OpenAPI.Example(value: .init(.init([ "hello": "world" ]))))]) let encodedContent = try! orderUnstableTestStringFromEncoding(of: content) assertJSONEquivalent( @@ -405,7 +405,7 @@ extension ContentTests { func test_vendorExtensions_encode() { let content = OpenAPI.Content( schema: .init(.string), - vendorExtensions: [ "x-hello": [ "world": 123 ] ] + vendorExtensions: [ "x-hello": .init([ "world": 123 ]) ] ) let encodedContent = try! orderUnstableTestStringFromEncoding(of: content) @@ -428,7 +428,7 @@ extension ContentTests { func test_vendorExtensions_encode_fixKey() { let content = OpenAPI.Content( schema: .init(.string), - vendorExtensions: [ "hello": [ "world": 123 ] ] + vendorExtensions: [ "hello": .init([ "world": 123 ]) ] ) let encodedContent = try! orderUnstableTestStringFromEncoding(of: content) diff --git a/Tests/OpenAPIKitTests/Document/DocumentInfoTests.swift b/Tests/OpenAPIKitTests/Document/DocumentInfoTests.swift index 298e7ee58..6106b934e 100644 --- a/Tests/OpenAPIKitTests/Document/DocumentInfoTests.swift +++ b/Tests/OpenAPIKitTests/Document/DocumentInfoTests.swift @@ -137,7 +137,7 @@ extension DocumentInfoTests { let license = OpenAPI.Document.Info.License( name: "MIT", url: URL(string: "http://website.com")!, - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedLicense = try orderUnstableTestStringFromEncoding(of: license) @@ -176,7 +176,7 @@ extension DocumentInfoTests { OpenAPI.Document.Info.License( name: "MIT", url: URL(string: "http://website.com")!, - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } @@ -274,7 +274,7 @@ extension DocumentInfoTests { func test_contact_vendorExtensions_encode() throws { let contact = OpenAPI.Document.Info.Contact( email: "email", - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedContact = try orderUnstableTestStringFromEncoding(of: contact) @@ -310,7 +310,7 @@ extension DocumentInfoTests { contact, .init( email: "email", - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } @@ -584,7 +584,7 @@ extension DocumentInfoTests { title: "title", license: .init(name: "license"), version: "1.0", - vendorExtensions: ["x-speacialFeature": ["hello", "world"]] + vendorExtensions: ["x-speacialFeature": .init(["hello", "world"])] ) let encodedInfo = try orderUnstableTestStringFromEncoding(of: info) @@ -630,7 +630,7 @@ extension DocumentInfoTests { title: "title", license: .init(name: "license"), version: "1.0", - vendorExtensions: ["x-speacialFeature": ["hello", "world"]] + vendorExtensions: ["x-speacialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKitTests/Document/DocumentTests.swift b/Tests/OpenAPIKitTests/Document/DocumentTests.swift index f66e4ecb0..70d632195 100644 --- a/Tests/OpenAPIKitTests/Document/DocumentTests.swift +++ b/Tests/OpenAPIKitTests/Document/DocumentTests.swift @@ -818,7 +818,7 @@ extension DocumentTests { paths: [:], components: .noComponents, externalDocs: .init(url: URL(string: "http://google.com")!), - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedDocument = try orderUnstableTestStringFromEncoding(of: document) @@ -874,7 +874,7 @@ extension DocumentTests { paths: [:], components: .noComponents, externalDocs: .init(url: URL(string: "http://google.com")!), - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKitTests/Document/ExternalDereferencingDocumentTests.swift b/Tests/OpenAPIKitTests/Document/ExternalDereferencingDocumentTests.swift index 3aa95b8f0..4f977a3d2 100644 --- a/Tests/OpenAPIKitTests/Document/ExternalDereferencingDocumentTests.swift +++ b/Tests/OpenAPIKitTests/Document/ExternalDereferencingDocumentTests.swift @@ -3,7 +3,7 @@ // import Foundation -import Yams +@preconcurrency import Yams import OpenAPIKit import XCTest diff --git a/Tests/OpenAPIKitTests/Operation/OperationTests.swift b/Tests/OpenAPIKitTests/Operation/OperationTests.swift index 5bd0c88cd..a5bea626f 100644 --- a/Tests/OpenAPIKitTests/Operation/OperationTests.swift +++ b/Tests/OpenAPIKitTests/Operation/OperationTests.swift @@ -7,7 +7,7 @@ import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class OperationTests: XCTestCase { func test_init() { @@ -138,7 +138,7 @@ extension OperationTests { deprecated: true, security: [[.component(named: "security"): []]], servers: [.init(url: URL(string: "https://google.com")!)], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedOperation = try orderUnstableTestStringFromEncoding(of: operation) @@ -312,7 +312,7 @@ extension OperationTests { deprecated: true, security: [[.component(named: "security"): []]], servers: [.init(url: URL(string: "https://google.com")!)], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) diff --git a/Tests/OpenAPIKitTests/Parameter/ParameterTests.swift b/Tests/OpenAPIKitTests/Parameter/ParameterTests.swift index e47093f44..6e86c40aa 100644 --- a/Tests/OpenAPIKitTests/Parameter/ParameterTests.swift +++ b/Tests/OpenAPIKitTests/Parameter/ParameterTests.swift @@ -827,7 +827,7 @@ extension ParameterTests { context: .path, schema: .string, description: "world", - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedParameter = try orderUnstableTestStringFromEncoding(of: parameter) @@ -880,7 +880,7 @@ extension ParameterTests { context: .path, schema: .string, description: "world", - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKitTests/Path Item/PathItemTests.swift b/Tests/OpenAPIKitTests/Path Item/PathItemTests.swift index 22c9e2601..ae47ff9e0 100644 --- a/Tests/OpenAPIKitTests/Path Item/PathItemTests.swift +++ b/Tests/OpenAPIKitTests/Path Item/PathItemTests.swift @@ -176,7 +176,7 @@ extension PathItemTests { description: "description", servers: [OpenAPI.Server(url: URL(string: "http://google.com")!)], parameters: [.parameter(name: "hello", context: .query, schema: .string)], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedPathItem = try orderUnstableTestStringFromEncoding(of: pathItem) @@ -246,7 +246,7 @@ extension PathItemTests { description: "description", servers: [OpenAPI.Server(url: URL(string: "http://google.com")!)], parameters: [.parameter(name: "hello", context: .query, schema: .string)], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } diff --git a/Tests/OpenAPIKitTests/Schema Object/JSONSchemaTests.swift b/Tests/OpenAPIKitTests/Schema Object/JSONSchemaTests.swift index 85f30f083..2f7ca5a47 100644 --- a/Tests/OpenAPIKitTests/Schema Object/JSONSchemaTests.swift +++ b/Tests/OpenAPIKitTests/Schema Object/JSONSchemaTests.swift @@ -1320,8 +1320,8 @@ final class SchemaObjectTests: XCTestCase { func test_withInitalAllowedValues() { let null = JSONSchema.null(.init(allowedValues: [nil])) let boolean = JSONSchema.boolean(.init(format: .unspecified, required: true, allowedValues: [false])) - let object = JSONSchema.object(.init(format: .unspecified, required: true, allowedValues: [[:]]), .init(properties: [:])) - let array = JSONSchema.array(.init(format: .unspecified, required: true, allowedValues: [[false]]), .init(items: .boolean(.init(format: .unspecified, required: true)))) + let object = JSONSchema.object(.init(format: .unspecified, required: true, allowedValues: [.init([:])]), .init(properties: [:])) + let array = JSONSchema.array(.init(format: .unspecified, required: true, allowedValues: [.init([false])]), .init(items: .boolean(.init(format: .unspecified, required: true)))) let number = JSONSchema.number(.init(format: .unspecified, required: true, allowedValues: [2.5]), .init()) let integer = JSONSchema.integer(.init(format: .unspecified, required: true, allowedValues: [5]), .init()) let string = JSONSchema.string(.init(format: .unspecified, required: true, allowedValues: ["hello"]), .init()) @@ -1329,7 +1329,7 @@ final class SchemaObjectTests: XCTestCase { XCTAssertEqual(null.allowedValues?[0].description, "nil") XCTAssertEqual(boolean.allowedValues, [false]) - XCTAssertEqual(object.allowedValues, [[:]]) + XCTAssertEqual(object.allowedValues, [.init([:])]) XCTAssertEqual(array.allowedValues?[0].value as! [Bool], [false]) XCTAssertEqual(number.allowedValues, [2.5]) XCTAssertEqual(integer.allowedValues, [5]) @@ -1342,9 +1342,9 @@ final class SchemaObjectTests: XCTestCase { let boolean = JSONSchema.boolean(.init(format: .unspecified, required: true)) .with(allowedValues: [false]) let object = JSONSchema.object(.init(format: .unspecified, required: true), .init(properties: [:])) - .with(allowedValues: [[:]]) + .with(allowedValues: [.init([:])]) let array = JSONSchema.array(.init(format: .unspecified, required: true), .init(items: .boolean(.init(format: .unspecified, required: true)))) - .with(allowedValues: [[false]]) + .with(allowedValues: [.init([false])]) let number = JSONSchema.number(.init(format: .unspecified, required: true), .init()) .with(allowedValues: [2.5]) let integer = JSONSchema.integer(.init(format: .unspecified, required: true), .init()) @@ -1384,8 +1384,8 @@ final class SchemaObjectTests: XCTestCase { func test_withInitalDefaultValue() { let null = JSONSchema.null(.init(defaultValue: nil)) let boolean = JSONSchema.boolean(.init(format: .unspecified, required: true, defaultValue: false)) - let object = JSONSchema.object(.init(format: .unspecified, required: true, defaultValue: [:]), .init(properties: [:])) - let array = JSONSchema.array(.init(format: .unspecified, required: true, defaultValue: [false]), .init(items: .boolean(.init(format: .unspecified, required: true)))) + let object = JSONSchema.object(.init(format: .unspecified, required: true, defaultValue: .init([:])), .init(properties: [:])) + let array = JSONSchema.array(.init(format: .unspecified, required: true, defaultValue: .init([false])), .init(items: .boolean(.init(format: .unspecified, required: true)))) let number = JSONSchema.number(.init(format: .unspecified, required: true, defaultValue: 2.5), .init()) let integer = JSONSchema.integer(.init(format: .unspecified, required: true, defaultValue: 5), .init()) let string = JSONSchema.string(.init(format: .unspecified, required: true, defaultValue: "hello"), .init()) @@ -1393,8 +1393,8 @@ final class SchemaObjectTests: XCTestCase { XCTAssertNil(null.defaultValue) XCTAssertEqual(boolean.defaultValue, false) - XCTAssertEqual(object.defaultValue, [:]) - XCTAssertEqual(array.defaultValue, [false]) + XCTAssertEqual(object.defaultValue, .init([:])) + XCTAssertEqual(array.defaultValue, .init([false])) XCTAssertEqual(number.defaultValue, 2.5) XCTAssertEqual(integer.defaultValue, 5) XCTAssertEqual(string.defaultValue, "hello") @@ -1406,9 +1406,9 @@ final class SchemaObjectTests: XCTestCase { let boolean = JSONSchema.boolean(.init(format: .unspecified, required: true)) .with(defaultValue: false) let object = JSONSchema.object(.init(format: .unspecified, required: true), .init(properties: [:])) - .with(defaultValue: [:]) + .with(defaultValue: .init([:])) let array = JSONSchema.array(.init(format: .unspecified, required: true), .init(items: .boolean(.init(format: .unspecified, required: true)))) - .with(defaultValue: [false]) + .with(defaultValue: .init([false])) let number = JSONSchema.number(.init(format: .unspecified, required: true), .init()) .with(defaultValue: 2.5) let integer = JSONSchema.integer(.init(format: .unspecified, required: true), .init()) @@ -1432,7 +1432,7 @@ final class SchemaObjectTests: XCTestCase { XCTAssertEqual(null.defaultValue!, nil) XCTAssertEqual(boolean.defaultValue, false) XCTAssertEqual(object.defaultValue, AnyCodable([String: String]())) - XCTAssertEqual(array.defaultValue, [false]) + XCTAssertEqual(array.defaultValue, .init([false])) XCTAssertEqual(number.defaultValue, 2.5) XCTAssertEqual(integer.defaultValue, 5) XCTAssertEqual(string.defaultValue, "hello") @@ -1447,7 +1447,7 @@ final class SchemaObjectTests: XCTestCase { } func test_withInitialExample() { - let object = JSONSchema.object(.init(format: .unspecified, required: true, examples: [[:]]), .init(properties: [:])) + let object = JSONSchema.object(.init(format: .unspecified, required: true, examples: [.init([:])]), .init(properties: [:])) let fragment = JSONSchema.fragment(.init(examples: ["hi"])) let null = JSONSchema.null(.init(examples: ["null"])) @@ -1477,7 +1477,7 @@ final class SchemaObjectTests: XCTestCase { let object = try JSONSchema.object(.init(format: .unspecified, required: true), .init(properties: [:])) .with(example: AnyCodable([String: String]())) let array = try JSONSchema.array(.init(), .init()) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let boolean = try JSONSchema.boolean(.init(format: .unspecified, required: true)) .with(example: true) @@ -1491,13 +1491,13 @@ final class SchemaObjectTests: XCTestCase { .with(example: "hello world") let allOf = try JSONSchema.all(of: [.string(.init(), .init())]) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let anyOf = try JSONSchema.any(of: [object]) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let oneOf = try JSONSchema.one(of: [object]) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let not = try JSONSchema.not(object) - .with(example: ["hello"]) + .with(example: .init(["hello"])) let fragment = try JSONSchema.fragment(.init()).with(example: "hi") let reference = try JSONSchema.reference(.external(URL(string: "hello/world.json#/hello")!),.init()).with(example: "hi") @@ -2356,7 +2356,7 @@ extension SchemaObjectTests { XCTAssertEqual(constValueObject.allowedValues?[0].value as! [String: Bool], ["hello": false]) XCTAssertEqual(allowedValueObject.allowedValues?[0].value as! [String: Bool], ["hello": false]) XCTAssertEqual(allowedValueObject.jsonTypeFormat, .object(.generic)) - XCTAssertEqual(defaultValueObject.defaultValue, ["hello": false]) + XCTAssertEqual(defaultValueObject.defaultValue, .init(["hello": false])) XCTAssertEqual(discriminatorObject, JSONSchema.object(discriminator: .init(propertyName: "hello"))) guard case let .object(_, contextB) = allowedValueObject.value else { @@ -3406,7 +3406,7 @@ extension SchemaObjectTests { XCTAssertEqual(nullableObject, JSONSchema.object(.init(format: .generic, nullable: true, examples: [AnyCodable(["hello": true])]), .init(properties: [:]))) XCTAssertEqual(allowedValueObject.allowedValues?[0].value as! [String: Bool], ["hello": false]) XCTAssertEqual(allowedValueObject.jsonTypeFormat, .object(.generic)) - XCTAssertEqual(allowedValueObject.examples, [["hello" : true]]) + XCTAssertEqual(allowedValueObject.examples, [.init(["hello" : true])]) guard case let .object(_, contextB) = allowedValueObject.value else { XCTFail("expected object to be parsed as object") @@ -3793,9 +3793,9 @@ extension SchemaObjectTests { let writeOnlyArray = JSONSchema.array(.init(format: .unspecified, required: true, permissions: .writeOnly), .init()) let deprecatedArray = JSONSchema.array(.init(format: .unspecified, required: true, deprecated: true), .init()) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init()) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) let defaultValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init()) - .with(defaultValue: [10]) + .with(defaultValue: .init([10])) let discriminatorArray = JSONSchema.array(.init(format: .unspecified, required: true, discriminator: .init(propertyName: "hello")), .init()) testAllSharedSimpleContextEncoding( @@ -3852,7 +3852,7 @@ extension SchemaObjectTests { XCTAssertEqual(writeOnlyArray, JSONSchema.array(.init(format: .generic, permissions: .writeOnly), .init())) XCTAssertEqual(deprecatedArray, JSONSchema.array(.init(format: .generic, deprecated: true), .init())) XCTAssertEqual(allowedValueArray.allowedValues?[0].value as! [Bool], [false]) - XCTAssertEqual(defaultValueArray.defaultValue, [false]) + XCTAssertEqual(defaultValueArray.defaultValue, .init([false])) XCTAssertEqual(discriminatorArray, JSONSchema.array(discriminator: .init(propertyName: "hello"))) guard case let .array(_, contextB) = allowedValueArray.value else { @@ -3887,7 +3887,7 @@ extension SchemaObjectTests { let optionalArray = JSONSchema.array(.init(format: .unspecified, required: false), .init(items: .boolean(.init(format: .unspecified, required: false)))) let nullableArray = JSONSchema.array(.init(format: .unspecified, required: true, nullable: true), .init(items: .boolean(.init(format: .unspecified, required: false)))) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init(items: .boolean(.init(format: .unspecified, required: false)))) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) testEncodingPropertyLines(entity: requiredArray, propertyLines: [ @@ -3965,7 +3965,7 @@ extension SchemaObjectTests { let optionalArray = JSONSchema.array(.init(format: .unspecified, required: false), .init(uniqueItems: true)) let nullableArray = JSONSchema.array(.init(format: .unspecified, required: true, nullable: true), .init(uniqueItems: true)) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init(uniqueItems: true)) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) testEncodingPropertyLines( entity: requiredArray, @@ -4035,7 +4035,7 @@ extension SchemaObjectTests { let optionalArray = JSONSchema.array(.init(format: .unspecified, required: false), .init(maxItems: 2)) let nullableArray = JSONSchema.array(.init(format: .unspecified, required: true, nullable: true), .init(maxItems: 2)) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init(maxItems: 2)) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) testEncodingPropertyLines(entity: requiredArray, propertyLines: [ @@ -4093,7 +4093,7 @@ extension SchemaObjectTests { let optionalArray = JSONSchema.array(.init(format: .unspecified, required: false), .init(minItems: 2)) let nullableArray = JSONSchema.array(.init(format: .unspecified, required: true, nullable: true), .init(minItems: 2)) let allowedValueArray = JSONSchema.array(.init(format: .unspecified, required: true), .init(minItems: 2)) - .with(allowedValues: [[10]]) + .with(allowedValues: [.init([10])]) testEncodingPropertyLines(entity: requiredArray, propertyLines: [ @@ -6830,8 +6830,8 @@ extension SchemaObjectTests { "hello": .boolean ], allowedValues: [ - [ "hello": true], - [ "hello": false] + .init([ "hello": true]), + .init([ "hello": false]) ], anchor: "test", dynamicAnchor: "test2", diff --git a/Tests/OpenAPIKitTests/Schema Object/SchemaObjectYamsTests.swift b/Tests/OpenAPIKitTests/Schema Object/SchemaObjectYamsTests.swift index 1d32f5d72..17bf08876 100644 --- a/Tests/OpenAPIKitTests/Schema Object/SchemaObjectYamsTests.swift +++ b/Tests/OpenAPIKitTests/Schema Object/SchemaObjectYamsTests.swift @@ -13,7 +13,7 @@ import Foundation import XCTest import OpenAPIKit -import Yams +@preconcurrency import Yams final class SchemaObjectYamsTests: XCTestCase { func test_nullTypeDecode() throws { diff --git a/Tests/OpenAPIKitTests/ServerTests.swift b/Tests/OpenAPIKitTests/ServerTests.swift index a9874050b..ea3a034d9 100644 --- a/Tests/OpenAPIKitTests/ServerTests.swift +++ b/Tests/OpenAPIKitTests/ServerTests.swift @@ -170,7 +170,7 @@ extension ServerTests { vendorExtensions: [ "x-otherThing": 1234 ] ) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) ) } @@ -187,7 +187,7 @@ extension ServerTests { vendorExtensions: [ "x-otherThing": 1234 ] ) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let encodedServer = try orderUnstableTestStringFromEncoding(of: server) diff --git a/Tests/OpenAPIKitTests/TestHelpers.swift b/Tests/OpenAPIKitTests/TestHelpers.swift index eadd92726..336866d5d 100644 --- a/Tests/OpenAPIKitTests/TestHelpers.swift +++ b/Tests/OpenAPIKitTests/TestHelpers.swift @@ -6,7 +6,7 @@ // import Foundation -import Yams +@preconcurrency import Yams import XCTest fileprivate let foundationTestEncoder = { () -> JSONEncoder in diff --git a/Tests/OpenAPIKitTests/Validator/BuiltinValidationTests.swift b/Tests/OpenAPIKitTests/Validator/BuiltinValidationTests.swift index 389ee2ddf..d4cd8b3d0 100644 --- a/Tests/OpenAPIKitTests/Validator/BuiltinValidationTests.swift +++ b/Tests/OpenAPIKitTests/Validator/BuiltinValidationTests.swift @@ -330,7 +330,7 @@ final class BuiltinValidationTests: XCTestCase { vendorExtensions: [ "x-otherThing": 1234 ] ) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let document = OpenAPI.Document( info: .init(title: "test", version: "1.0"), @@ -357,7 +357,7 @@ final class BuiltinValidationTests: XCTestCase { vendorExtensions: [ "x-otherThing": 1234 ] ) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let document = OpenAPI.Document( info: .init(title: "test", version: "1.0"), @@ -381,7 +381,7 @@ final class BuiltinValidationTests: XCTestCase { vendorExtensions: [ "x-otherThing": 1234 ] ) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let document = OpenAPI.Document( info: .init(title: "test", version: "1.0"), @@ -408,7 +408,7 @@ final class BuiltinValidationTests: XCTestCase { vendorExtensions: [ "x-otherThing": 1234 ] ) ], - vendorExtensions: ["x-specialFeature": ["hello", "world"]] + vendorExtensions: ["x-specialFeature": .init(["hello", "world"])] ) let document = OpenAPI.Document( info: .init(title: "test", version: "1.0"), diff --git a/Tests/OpenAPIKitTests/Validator/ValidatorTests.swift b/Tests/OpenAPIKitTests/Validator/ValidatorTests.swift index 3f49c5e4f..d8351cade 100644 --- a/Tests/OpenAPIKitTests/Validator/ValidatorTests.swift +++ b/Tests/OpenAPIKitTests/Validator/ValidatorTests.swift @@ -85,7 +85,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -112,7 +112,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -144,7 +144,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -180,7 +180,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -212,7 +212,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -242,7 +242,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -278,7 +278,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -312,7 +312,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -324,7 +324,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -360,7 +360,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -396,7 +396,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -433,7 +433,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -470,7 +470,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -506,7 +506,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -688,7 +688,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -722,7 +722,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -818,7 +818,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -869,7 +869,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hello", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -920,7 +920,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -958,7 +958,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -1002,7 +1002,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -1045,7 +1045,7 @@ final class ValidatorTests: XCTestCase { "x-string": "hiya", "x-int": 2244, "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]) ] ) @@ -1339,7 +1339,7 @@ final class ValidatorTests: XCTestCase { vendorExtensions: [ "x-string": "hiya", "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]), "x-float": AnyCodable(22.5 as Float), "x-bool": true @@ -1377,7 +1377,7 @@ final class ValidatorTests: XCTestCase { vendorExtensions: [ "x-string": "hiya", "x-double": 10.5, - "x-dict": [ "string": "world"], + "x-dict": .init([ "string": "world"]), "x-array": AnyCodable(["hello", nil, "world"]), "x-float": AnyCodable(22.5 as Float), "x-bool": true diff --git a/Tests/OpenAPIKitTests/VendorExtendableTests.swift b/Tests/OpenAPIKitTests/VendorExtendableTests.swift index da10a74db..b6fe00ed2 100644 --- a/Tests/OpenAPIKitTests/VendorExtendableTests.swift +++ b/Tests/OpenAPIKitTests/VendorExtendableTests.swift @@ -39,13 +39,13 @@ final class VendorExtendableTests: XCTestCase { func test_encodeSuccess() throws { let test = TestStruct(vendorExtensions: [ "x-tension": "hello", - "x-two": [ + "x-two": .init([ "cool", "beans" - ], - "x-three": [ + ]), + "x-three": .init([ "nested": 10 - ] + ]) ]) let _ = try JSONEncoder().encode(test) @@ -85,13 +85,13 @@ extension VendorExtendableTests { func test_encode() throws { let test = TestStruct(vendorExtensions: [ "x-tension": "hello", - "x-two": [ + "x-two": .init([ "cool", "beans" - ], - "x-three": [ + ]), + "x-three": .init([ "nested": 10 - ] + ]) ]) let encoded = try orderUnstableTestStringFromEncoding(of: test) diff --git a/Tests/OrderedDictionaryTests/OrderedDictionaryTests.swift b/Tests/OrderedDictionaryTests/OrderedDictionaryTests.swift index 06235553e..3b5b3903b 100644 --- a/Tests/OrderedDictionaryTests/OrderedDictionaryTests.swift +++ b/Tests/OrderedDictionaryTests/OrderedDictionaryTests.swift @@ -7,7 +7,7 @@ import OpenAPIKitCore import XCTest -import Yams +@preconcurrency import Yams final class OrderedDictionaryTests: XCTestCase { func test_initGrouping() {