diff --git a/AmplifyTestCommon/Helpers/AmplifyAssertions.swift b/AmplifyTestCommon/Helpers/AmplifyAssertions.swift index b98e763c92..2dc4abd66e 100644 --- a/AmplifyTestCommon/Helpers/AmplifyAssertions.swift +++ b/AmplifyTestCommon/Helpers/AmplifyAssertions.swift @@ -10,10 +10,11 @@ import XCTest @testable import CwlPreconditionTesting -public func XCTAssertThrowFatalError(_ expression: @escaping () -> Void, - file: StaticString = #file, - line: UInt = #line) throws -{ +public func XCTAssertThrowFatalError( + _ expression: @escaping () -> Void, + file: StaticString = #file, + line: UInt = #line +) throws { #if (os(iOS) || os(macOS)) && (arch(arm64) || arch(x86_64)) var reached = false let exception = catchBadInstruction { @@ -27,10 +28,11 @@ public func XCTAssertThrowFatalError(_ expression: @escaping () -> Void, #endif } -public func XCTAssertNoThrowFatalError(_ expression: @escaping () -> Void, - file: StaticString = #file, - line: UInt = #line) throws -{ +public func XCTAssertNoThrowFatalError( + _ expression: @escaping () -> Void, + file: StaticString = #file, + line: UInt = #line +) throws { #if (os(iOS) || os(macOS)) && (arch(arm64) || arch(x86_64)) var reached = false let exception = catchBadInstruction { diff --git a/AmplifyTestCommon/Helpers/HubListenerTestUtilities.swift b/AmplifyTestCommon/Helpers/HubListenerTestUtilities.swift index 744fd9ff7e..31861451fc 100644 --- a/AmplifyTestCommon/Helpers/HubListenerTestUtilities.swift +++ b/AmplifyTestCommon/Helpers/HubListenerTestUtilities.swift @@ -17,12 +17,13 @@ enum HubListenerTestUtilities { /// - Parameter plugin: the plugin on which the listener will be checked /// - Parameter timeout: the maximum length of time to wait for the listener to be registered /// - Throws: if the plugin cannot be cast to `AWSHubPlugin` - static func waitForListener(with token: UnsubscribeToken, - plugin: HubCategoryPlugin? = nil, - timeout: TimeInterval, - file: StaticString = #file, - line: UInt = #line) async throws -> Bool - { + static func waitForListener( + with token: UnsubscribeToken, + plugin: HubCategoryPlugin? = nil, + timeout: TimeInterval, + file: StaticString = #file, + line: UInt = #line + ) async throws -> Bool { let plugin = try plugin ?? Amplify.Hub.getPlugin(for: AWSHubPlugin.key) diff --git a/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift index 01f6de2bfb..779d2a99a3 100644 --- a/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift @@ -13,8 +13,7 @@ import Foundation class MockAPICategoryPlugin: MessageReporter, APICategoryPlugin, APICategoryReachabilityBehavior, - APICategoryGraphQLBehavior -{ + APICategoryGraphQLBehavior { var authProviderFactory: APIAuthProviderFactory? @@ -86,12 +85,14 @@ class MockAPICategoryPlugin: MessageReporter, } let requestOptions = GraphQLOperationRequest.Options(pluginOptions: nil) - let request = GraphQLOperationRequest(apiName: request.apiName, - operationType: .subscription, - document: request.document, - variables: request.variables, - responseType: request.responseType, - options: requestOptions) + let request = GraphQLOperationRequest( + apiName: request.apiName, + operationType: .subscription, + document: request.document, + variables: request.variables, + responseType: request.responseType, + options: requestOptions + ) let taskRunner = MockAWSGraphQLSubscriptionTaskRunner(request: request) return taskRunner.sequence @@ -113,12 +114,14 @@ class MockAPICategoryPlugin: MessageReporter, func get(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { notify("get") - let operationRequest = RESTOperationRequest(apiName: request.apiName, - operationType: .get, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let operationRequest = RESTOperationRequest( + apiName: request.apiName, + operationType: .get, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: operationRequest) return operation } @@ -130,24 +133,28 @@ class MockAPICategoryPlugin: MessageReporter, func put(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { notify("put") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .put, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .put, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) return operation } func put(request: RESTRequest) async throws -> RESTTask.Success { notify("put") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .put, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .put, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) let taskAdapter = AmplifyOperationTaskAdapter(operation: operation) return try await taskAdapter.value @@ -155,24 +162,28 @@ class MockAPICategoryPlugin: MessageReporter, func post(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { notify("post") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .post, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .post, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) return operation } func post(request: RESTRequest) async throws -> RESTTask.Success { notify("post") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .post, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .post, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) let taskAdapter = AmplifyOperationTaskAdapter(operation: operation) return try await taskAdapter.value @@ -180,24 +191,28 @@ class MockAPICategoryPlugin: MessageReporter, func delete(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { notify("delete") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .delete, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .delete, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) return operation } func delete(request: RESTRequest) async throws -> RESTTask.Success { notify("delete") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .delete, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .delete, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) let taskAdapter = AmplifyOperationTaskAdapter(operation: operation) return try await taskAdapter.value @@ -205,24 +220,28 @@ class MockAPICategoryPlugin: MessageReporter, func patch(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { notify("patch") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .patch, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .patch, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) return operation } func patch(request: RESTRequest) async throws -> RESTTask.Success { notify("patch") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .patch, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .patch, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) let taskAdapter = AmplifyOperationTaskAdapter(operation: operation) return try await taskAdapter.value @@ -230,24 +249,28 @@ class MockAPICategoryPlugin: MessageReporter, func head(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { notify("head") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .head, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .head, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) return operation } func head(request: RESTRequest) async throws -> RESTTask.Success { notify("head") - let request = RESTOperationRequest(apiName: request.apiName, - operationType: .head, - path: request.path, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + let request = RESTOperationRequest( + apiName: request.apiName, + operationType: .head, + path: request.path, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) let operation = MockAPIOperation(request: request) let taskAdapter = AmplifyOperationTaskAdapter(operation: operation) return try await taskAdapter.value @@ -282,12 +305,15 @@ class MockGraphQLOperation: GraphQLOperation { override func resume() { } - init(request: Request, - responseType: R.Type) - { - super.init(categoryType: .api, - eventName: HubPayload.EventName.API.mutate, - request: request) + init( + request: Request, + responseType: R.Type + ) { + super.init( + categoryType: .api, + eventName: HubPayload.EventName.API.mutate, + request: request + ) } } @@ -299,12 +325,15 @@ class MockSubscriptionGraphQLOperation: GraphQLSubscriptionOperati override func resume() { } - init(request: Request, - responseType: R.Type) - { - super.init(categoryType: .api, - eventName: HubPayload.EventName.API.subscribe, - request: request) + init( + request: Request, + responseType: R.Type + ) { + super.init( + categoryType: .api, + eventName: HubPayload.EventName.API.subscribe, + request: request + ) } } @@ -316,9 +345,11 @@ class MockAPIOperation: AmplifyOperation, } init(request: Request) { - super.init(categoryType: .api, - eventName: request.operationType.hubEventName, - request: request) + super.init( + categoryType: .api, + eventName: request.operationType.hubEventName, + request: request + ) } } @@ -326,9 +357,10 @@ class MockAPIAuthProviderFactory: APIAuthProviderFactory { let oidcProvider: AmplifyOIDCAuthProvider? let functionProvider: AmplifyFunctionAuthProvider? - init(oidcProvider: AmplifyOIDCAuthProvider? = nil, - functionProvider: AmplifyFunctionAuthProvider? = nil) - { + init( + oidcProvider: AmplifyOIDCAuthProvider? = nil, + functionProvider: AmplifyFunctionAuthProvider? = nil + ) { self.oidcProvider = oidcProvider self.functionProvider = functionProvider } diff --git a/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift index 9223b7b566..de39825acd 100644 --- a/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift @@ -14,10 +14,11 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { fatalError() } - func signIn(username: String, - password: String, - options: AuthSignInRequest.Options?) async throws -> AuthSignInResult - { + func signIn( + username: String, + password: String, + options: AuthSignInRequest.Options? + ) async throws -> AuthSignInResult { fatalError() } @@ -25,10 +26,11 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { fatalError() } - public func confirmSignUp(for username: String, - confirmationCode: String, - options: AuthConfirmSignUpRequest.Options? = nil) async throws -> AuthSignUpResult - { + public func confirmSignUp( + for username: String, + confirmationCode: String, + options: AuthConfirmSignUpRequest.Options? = nil + ) async throws -> AuthSignUpResult { fatalError() } @@ -36,31 +38,35 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { fatalError() } - public func signIn(username: String? = nil, - password: String? = nil, - options: AuthSignInRequest.Options? = nil) async throws -> AuthSignInResult - { + public func signIn( + username: String? = nil, + password: String? = nil, + options: AuthSignInRequest.Options? = nil + ) async throws -> AuthSignInResult { fatalError() } #if os(iOS) || os(macOS) - public func signInWithWebUI(presentationAnchor: AuthUIPresentationAnchor? = nil, - options: AuthWebUISignInRequest.Options? = nil) async throws -> AuthSignInResult - { + public func signInWithWebUI( + presentationAnchor: AuthUIPresentationAnchor? = nil, + options: AuthWebUISignInRequest.Options? = nil + ) async throws -> AuthSignInResult { fatalError() } - public func signInWithWebUI(for authProvider: AuthProvider, - presentationAnchor: AuthUIPresentationAnchor? = nil, - options: AuthWebUISignInRequest.Options? = nil) async throws -> AuthSignInResult - { + public func signInWithWebUI( + for authProvider: AuthProvider, + presentationAnchor: AuthUIPresentationAnchor? = nil, + options: AuthWebUISignInRequest.Options? = nil + ) async throws -> AuthSignInResult { fatalError() } #endif - public func confirmSignIn(challengeResponse: String, - options: AuthConfirmSignInRequest.Options? = nil) async throws -> AuthSignInResult - { + public func confirmSignIn( + challengeResponse: String, + options: AuthConfirmSignInRequest.Options? = nil + ) async throws -> AuthSignInResult { fatalError() } @@ -80,11 +86,12 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { fatalError() } - public func confirmResetPassword(for username: String, - with newPassword: String, - confirmationCode: String, - options: AuthConfirmResetPasswordRequest.Options? = nil) async throws - { + public func confirmResetPassword( + for username: String, + with newPassword: String, + confirmationCode: String, + options: AuthConfirmResetPasswordRequest.Options? = nil + ) async throws { fatalError() } @@ -101,14 +108,14 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { } public func resendConfirmationCode(forUserAttributeKey userAttributeKey: AuthUserAttributeKey, options: AuthAttributeResendConfirmationCodeRequest.Options? = nil) - async throws -> AuthCodeDeliveryDetails - { + async throws -> AuthCodeDeliveryDetails { fatalError() } public func sendVerificationCode( forUserAttributeKey userAttributeKey: AuthUserAttributeKey, - options: AuthSendUserAttributeVerificationCodeRequest.Options? = nil) + options: AuthSendUserAttributeVerificationCodeRequest.Options? = nil + ) async throws -> AuthCodeDeliveryDetails { fatalError() } @@ -124,17 +131,19 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { fatalError() } - public func confirm(userAttribute: AuthUserAttributeKey, - confirmationCode: String, - options: AuthConfirmUserAttributeRequest.Options? = nil) async throws - { + public func confirm( + userAttribute: AuthUserAttributeKey, + confirmationCode: String, + options: AuthConfirmUserAttributeRequest.Options? = nil + ) async throws { fatalError() } - public func update(oldPassword: String, - to newPassword: String, - options: AuthChangePasswordRequest.Options? = nil) async throws - { + public func update( + oldPassword: String, + to newPassword: String, + options: AuthChangePasswordRequest.Options? = nil + ) async throws { notify("changePassword") } diff --git a/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift index 191cad875c..7f9944b46a 100644 --- a/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift @@ -24,34 +24,38 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { notify("reset") } - func save(_ model: M, - where condition: QueryPredicate? = nil, - completion: @escaping (DataStoreResult) -> Void) - { + func save( + _ model: M, + where condition: QueryPredicate? = nil, + completion: @escaping (DataStoreResult) -> Void + ) { notify("save") if let responder = responders[.saveModelListener] as? SaveModelResponder { Task { - if let callback = await responder.callback((model: model, - where: condition)) - { + if let callback = await responder.callback(( + model: model, + where: condition + )) { completion(callback) } } } } - func save(_ model: M, - where condition: QueryPredicate? = nil) async throws -> M - { + func save( + _ model: M, + where condition: QueryPredicate? = nil + ) async throws -> M { notify("save") return model } - func query(_ modelType: M.Type, - byId id: String, - completion: @escaping (DataStoreResult) -> Void) - { + func query( + _ modelType: M.Type, + byId id: String, + completion: @escaping (DataStoreResult) -> Void + ) { notify("queryById") if let responder = responders[.queryByIdListener] as? QueryByIdResponder { @@ -63,18 +67,20 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } - func query(_ modelType: M.Type, - byId id: String) async throws -> M? - { + func query( + _ modelType: M.Type, + byId id: String + ) async throws -> M? { notify("queryById") return nil } - func query(_ modelType: M.Type, - byIdentifier id: String, - completion: @escaping (DataStoreResult) -> Void) where M: ModelIdentifiable, - M.IdentifierFormat == ModelIdentifierFormat.Default - { + func query( + _ modelType: M.Type, + byIdentifier id: String, + completion: @escaping (DataStoreResult) -> Void + ) where M: ModelIdentifiable, + M.IdentifierFormat == ModelIdentifierFormat.Default { notify("queryByIdentifier") if let responder = responders[.queryByIdListener] as? QueryByIdResponder { @@ -86,48 +92,53 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } - func query(_ modelType: M.Type, - byIdentifier id: String) async throws -> M? where M: ModelIdentifiable, - M.IdentifierFormat == ModelIdentifierFormat.Default - { + func query( + _ modelType: M.Type, + byIdentifier id: String + ) async throws -> M? where M: ModelIdentifiable, + M.IdentifierFormat == ModelIdentifierFormat.Default { notify("queryByIdentifier") return nil } - func query(_ modelType: M.Type, - where predicate: QueryPredicate?, - sort sortInput: QuerySortInput?, - paginate paginationInput: QueryPaginationInput?, - completion: @escaping (DataStoreResult<[M]>) -> Void) - { + func query( + _ modelType: M.Type, + where predicate: QueryPredicate?, + sort sortInput: QuerySortInput?, + paginate paginationInput: QueryPaginationInput?, + completion: @escaping (DataStoreResult<[M]>) -> Void + ) { notify("queryByPredicate") if let responder = responders[.queryModelsListener] as? QueryModelsResponder { Task { - if let result = await responder.callback((modelType: modelType, - where: predicate, - sort: sortInput, - paginate: paginationInput)) - { + if let result = await responder.callback(( + modelType: modelType, + where: predicate, + sort: sortInput, + paginate: paginationInput + )) { completion(result) } } } } - func query(_ modelType: M.Type, - where predicate: QueryPredicate?, - sort sortInput: QuerySortInput?, - paginate paginationInput: QueryPaginationInput?) async throws -> [M] - { + func query( + _ modelType: M.Type, + where predicate: QueryPredicate?, + sort sortInput: QuerySortInput?, + paginate paginationInput: QueryPaginationInput? + ) async throws -> [M] { notify("queryByPredicate") if let responder = responders[.queryModelsListener] as? QueryModelsResponder { - if let result = await responder.callback((modelType: modelType, - where: predicate, - sort: sortInput, - paginate: paginationInput)) - { + if let result = await responder.callback(( + modelType: modelType, + where: predicate, + sort: sortInput, + paginate: paginationInput + )) { switch result { case .success(let models): return models @@ -140,10 +151,11 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { return [] } - func query(_ modelType: M.Type, - byIdentifier id: ModelIdentifier, - completion: @escaping (DataStoreResult) -> Void) where M: Model, M: ModelIdentifiable - { + func query( + _ modelType: M.Type, + byIdentifier id: ModelIdentifier, + completion: @escaping (DataStoreResult) -> Void + ) where M: Model, M: ModelIdentifiable { notify("queryWithIdentifier") if let responder = responders[.queryByIdListener] as? QueryByIdResponder { @@ -155,19 +167,21 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } - func query(_ modelType: M.Type, - byIdentifier id: ModelIdentifier) async throws -> M? - where M: Model, M: ModelIdentifiable - { + func query( + _ modelType: M.Type, + byIdentifier id: ModelIdentifier + ) async throws -> M? + where M: Model, M: ModelIdentifiable { notify("queryWithIdentifier") return nil } - func delete(_ modelType: M.Type, - withId id: String, - where predicate: QueryPredicate? = nil, - completion: @escaping (DataStoreResult) -> Void) - { + func delete( + _ modelType: M.Type, + withId id: String, + where predicate: QueryPredicate? = nil, + completion: @escaping (DataStoreResult) -> Void + ) { notify("deleteById") if let responder = responders[.deleteByIdListener] as? DeleteByIdResponder { @@ -179,19 +193,21 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } - func delete(_ modelType: (some Model).Type, - withId id: String, - where predicate: QueryPredicate? = nil) async throws - { + func delete( + _ modelType: (some Model).Type, + withId id: String, + where predicate: QueryPredicate? = nil + ) async throws { notify("deleteById") } - func delete(_ modelType: M.Type, - withIdentifier id: String, - where predicate: QueryPredicate? = nil, - completion: @escaping (DataStoreResult) -> Void) where M: ModelIdentifiable, - M.IdentifierFormat == ModelIdentifierFormat.Default - { + func delete( + _ modelType: M.Type, + withIdentifier id: String, + where predicate: QueryPredicate? = nil, + completion: @escaping (DataStoreResult) -> Void + ) where M: ModelIdentifiable, + M.IdentifierFormat == ModelIdentifierFormat.Default { notify("deleteByIdentifier") if let responder = responders[.deleteByIdListener] as? DeleteByIdResponder { @@ -203,19 +219,21 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } - func delete(_ modelType: M.Type, - withIdentifier id: String, - where predicate: QueryPredicate? = nil) async throws - where M: ModelIdentifiable, M.IdentifierFormat == ModelIdentifierFormat.Default - { + func delete( + _ modelType: M.Type, + withIdentifier id: String, + where predicate: QueryPredicate? = nil + ) async throws + where M: ModelIdentifiable, M.IdentifierFormat == ModelIdentifierFormat.Default { notify("deleteByIdentifier") } - func delete(_ modelType: M.Type, - withIdentifier id: ModelIdentifier, - where predicate: QueryPredicate?, - completion: @escaping DataStoreCallback) where M: Model, M: ModelIdentifiable - { + func delete( + _ modelType: M.Type, + withIdentifier id: ModelIdentifier, + where predicate: QueryPredicate?, + completion: @escaping DataStoreCallback + ) where M: Model, M: ModelIdentifiable { notify("deleteByIdentifier") if let responder = responders[.deleteByIdListener] as? DeleteByIdResponder { @@ -227,17 +245,19 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } - func delete(_ modelType: M.Type, - withIdentifier id: ModelIdentifier, - where predicate: QueryPredicate?) async throws where M: Model, M: ModelIdentifiable - { + func delete( + _ modelType: M.Type, + withIdentifier id: ModelIdentifier, + where predicate: QueryPredicate? + ) async throws where M: Model, M: ModelIdentifiable { notify("deleteByIdentifier") } - func delete(_ modelType: M.Type, - where predicate: QueryPredicate, - completion: @escaping (DataStoreResult) -> Void) - { + func delete( + _ modelType: M.Type, + where predicate: QueryPredicate, + completion: @escaping (DataStoreResult) -> Void + ) { notify("deleteModelTypeByPredicate") if let responder = responders[.deleteModelTypeListener] as? DeleteModelTypeResponder { @@ -249,32 +269,36 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } - func delete(_ modelType: (some Model).Type, - where predicate: QueryPredicate) async throws - { + func delete( + _ modelType: (some Model).Type, + where predicate: QueryPredicate + ) async throws { notify("deleteModelTypeByPredicate") } - func delete(_ model: M, - where predicate: QueryPredicate? = nil, - completion: @escaping DataStoreCallback) - { + func delete( + _ model: M, + where predicate: QueryPredicate? = nil, + completion: @escaping DataStoreCallback + ) { notify("deleteByPredicate") if let responder = responders[.deleteModelListener] as? DeleteModelResponder { Task { - if let callback = await responder.callback((model: model, - where: predicate)) - { + if let callback = await responder.callback(( + model: model, + where: predicate + )) { completion(callback) } } } } - func delete(_ model: some Model, - where predicate: QueryPredicate? = nil) async throws - { + func delete( + _ model: some Model, + where predicate: QueryPredicate? = nil + ) async throws { notify("deleteByPredicate") } @@ -328,12 +352,14 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { func publisher(for modelType: (some Model).Type) -> AnyPublisher { - let mutationEvent = MutationEvent(id: "testevent", - modelId: "123", - modelName: modelType.modelName, - json: "", - mutationType: .create, - createdAt: .now()) + let mutationEvent = MutationEvent( + id: "testevent", + modelId: "123", + modelName: modelType.modelName, + json: "", + mutationType: .create, + createdAt: .now() + ) notify("publisher") return Result.Publisher(mutationEvent).eraseToAnyPublisher() } @@ -342,19 +368,22 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { return AmplifyAsyncThrowingSequence(parent: nil) } - public func observeQuery(for modelType: M.Type, - where predicate: QueryPredicate? = nil, - sort sortInput: QuerySortInput? = nil) + public func observeQuery( + for modelType: M.Type, + where predicate: QueryPredicate? = nil, + sort sortInput: QuerySortInput? = nil + ) -> AnyPublisher, DataStoreError> { notify("observeQuery") let snapshot = DataStoreQuerySnapshot(items: [], isSynced: false) return Result.Publisher(snapshot).eraseToAnyPublisher() } - func observeQuery(for modelType: M.Type, - where predicate: QueryPredicate?, - sort sortInput: QuerySortInput?) -> AmplifyAsyncThrowingSequence> - { + func observeQuery( + for modelType: M.Type, + where predicate: QueryPredicate?, + sort sortInput: QuerySortInput? + ) -> AmplifyAsyncThrowingSequence> { let request = ObserveQueryRequest(options: []) let taskRunner = MockObserveQueryTaskRunner(request: request) diff --git a/AmplifyTestCommon/Mocks/MockGeoCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockGeoCategoryPlugin.swift index f328e48b6f..55c7839975 100644 --- a/AmplifyTestCommon/Mocks/MockGeoCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockGeoCategoryPlugin.swift @@ -42,22 +42,25 @@ class MockGeoCategoryPlugin: MessageReporter, GeoCategoryPlugin { } private func createMapStyle() -> Geo.MapStyle { - Geo.MapStyle(mapName: "MapName", - style: "MapStyle", - styleURL: URL(string: "http://MapStyleURL")!) + Geo.MapStyle( + mapName: "MapName", + style: "MapStyle", + styleURL: URL(string: "http://MapStyleURL")! + ) } private func createPlace() -> Geo.Place { - Geo.Place(coordinates: Geo.Coordinates(latitude: 0, longitude: 0), - label: "Place Label", - addressNumber: nil, - street: nil, - municipality: nil, - neighborhood: nil, - region: nil, - subRegion: nil, - postalCode: nil, - country: nil + Geo.Place( + coordinates: Geo.Coordinates(latitude: 0, longitude: 0), + label: "Place Label", + addressNumber: nil, + street: nil, + municipality: nil, + neighborhood: nil, + region: nil, + subRegion: nil, + postalCode: nil, + country: nil ) } } diff --git a/AmplifyTestCommon/Mocks/MockHubCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockHubCategoryPlugin.swift index fc66a90fb6..57df57ad97 100644 --- a/AmplifyTestCommon/Mocks/MockHubCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockHubCategoryPlugin.swift @@ -26,18 +26,20 @@ class MockHubCategoryPlugin: MessageReporter, HubCategoryPlugin { notify("dispatch") } - func listen(to channel: HubChannel, - eventName: HubPayloadEventName, - listener: @escaping HubListener) -> UnsubscribeToken - { + func listen( + to channel: HubChannel, + eventName: HubPayloadEventName, + listener: @escaping HubListener + ) -> UnsubscribeToken { notify("listenEventName") return UnsubscribeToken(channel: channel, id: UUID()) } - func listen(to channel: HubChannel, - isIncluded filter: HubFilter?, - listener: @escaping HubListener) -> UnsubscribeToken - { + func listen( + to channel: HubChannel, + isIncluded filter: HubFilter?, + listener: @escaping HubListener + ) -> UnsubscribeToken { notify("listen") return UnsubscribeToken(channel: channel, id: UUID()) } diff --git a/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift index 353023c875..81e90e4499 100644 --- a/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift @@ -10,20 +10,22 @@ import Foundation class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { - func getURL(key: String, - options: StorageGetURLRequest.Options?, - resultListener: StorageGetURLOperation.ResultListener?) -> StorageGetURLOperation - { + func getURL( + key: String, + options: StorageGetURLRequest.Options?, + resultListener: StorageGetURLOperation.ResultListener? + ) -> StorageGetURLOperation { notify("getURL") let options = options ?? StorageGetURLRequest.Options() let request = StorageGetURLRequest(key: key, options: options) return MockStorageGetURLOperation(request: request) } - func downloadData(key: String, - options: StorageDownloadDataRequest.Options?, - progressListener: ProgressListener? = nil, - resultListener: StorageDownloadDataOperation.ResultListener? + func downloadData( + key: String, + options: StorageDownloadDataRequest.Options?, + progressListener: ProgressListener? = nil, + resultListener: StorageDownloadDataOperation.ResultListener? ) -> StorageDownloadDataOperation { notify("downloadData") let options = options ?? StorageDownloadDataRequest.Options() @@ -31,11 +33,12 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { return MockStorageDownloadDataOperation(request: request) } - func downloadFile(key: String, - local: URL, - options: StorageDownloadFileRequest.Options?, - progressListener: ProgressListener? = nil, - resultListener: StorageDownloadFileOperation.ResultListener? + func downloadFile( + key: String, + local: URL, + options: StorageDownloadFileRequest.Options?, + progressListener: ProgressListener? = nil, + resultListener: StorageDownloadFileOperation.ResultListener? ) -> StorageDownloadFileOperation { notify("downloadFile") let options = options ?? StorageDownloadFileRequest.Options() @@ -43,11 +46,12 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { return MockStorageDownloadFileOperation(request: request) } - func uploadData(key: String, - data: Data, - options: StorageUploadDataRequest.Options?, - progressListener: ProgressListener? = nil, - resultListener: StorageUploadDataOperation.ResultListener? + func uploadData( + key: String, + data: Data, + options: StorageUploadDataRequest.Options?, + progressListener: ProgressListener? = nil, + resultListener: StorageUploadDataOperation.ResultListener? ) -> StorageUploadDataOperation { notify("uploadData") let options = options ?? StorageUploadDataRequest.Options() @@ -55,11 +59,12 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { return MockStorageUploadDataOperation(request: request) } - func uploadFile(key: String, - local: URL, - options: StorageUploadFileRequest.Options?, - progressListener: ProgressListener? = nil, - resultListener: StorageUploadFileOperation.ResultListener? + func uploadFile( + key: String, + local: URL, + options: StorageUploadFileRequest.Options?, + progressListener: ProgressListener? = nil, + resultListener: StorageUploadFileOperation.ResultListener? ) -> StorageUploadFileOperation { notify("uploadFile") let options = options ?? StorageUploadFileRequest.Options() @@ -67,19 +72,21 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { return MockStorageUploadFileOperation(request: request) } - func remove(key: String, - options: StorageRemoveRequest.Options?, - resultListener: StorageRemoveOperation.ResultListener?) -> StorageRemoveOperation - { + func remove( + key: String, + options: StorageRemoveRequest.Options?, + resultListener: StorageRemoveOperation.ResultListener? + ) -> StorageRemoveOperation { notify("remove") let options = options ?? StorageRemoveRequest.Options() let request = StorageRemoveRequest(key: key, options: options) return MockStorageRemoveOperation(request: request) } - func list(options: StorageListRequest.Options?, - resultListener: StorageListOperation.ResultListener?) -> StorageListOperation - { + func list( + options: StorageListRequest.Options?, + resultListener: StorageListOperation.ResultListener? + ) -> StorageListOperation { notify("list") let options = options ?? StorageListRequest.Options() let request = StorageListRequest(options: options) @@ -101,9 +108,10 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { // MARK: - Async API - @discardableResult - func getURL(key: String, - options: StorageGetURLOperation.Request.Options?) async throws -> URL - { + func getURL( + key: String, + options: StorageGetURLOperation.Request.Options? + ) async throws -> URL { notify("getURL") let options = options ?? StorageGetURLRequest.Options() let request = StorageGetURLRequest(key: key, options: options) @@ -113,9 +121,10 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { } @discardableResult - func remove(key: String, - options: StorageRemoveRequest.Options? = nil) async throws -> String - { + func remove( + key: String, + options: StorageRemoveRequest.Options? = nil + ) async throws -> String { notify("remove") let options = options ?? StorageRemoveRequest.Options() let request = StorageRemoveRequest(key: key, options: options) @@ -125,9 +134,10 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { } @discardableResult - func downloadData(key: String, - options: StorageDownloadDataOperation.Request.Options? = nil) -> StorageDownloadDataTask - { + func downloadData( + key: String, + options: StorageDownloadDataOperation.Request.Options? = nil + ) -> StorageDownloadDataTask { notify("downloadData") let options = options ?? StorageDownloadDataRequest.Options() let request = StorageDownloadDataRequest(key: key, options: options) @@ -137,10 +147,11 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { } @discardableResult - func downloadFile(key: String, - local: URL, - options: StorageDownloadFileOperation.Request.Options?) -> StorageDownloadFileTask - { + func downloadFile( + key: String, + local: URL, + options: StorageDownloadFileOperation.Request.Options? + ) -> StorageDownloadFileTask { notify("downloadFile") let options = options ?? StorageDownloadFileRequest.Options() let request = StorageDownloadFileRequest(key: key, local: local, options: options) @@ -150,10 +161,11 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { } @discardableResult - func uploadData(key: String, - data: Data, - options: StorageUploadDataOperation.Request.Options?) -> StorageUploadDataTask - { + func uploadData( + key: String, + data: Data, + options: StorageUploadDataOperation.Request.Options? + ) -> StorageUploadDataTask { notify("uploadData") let options = options ?? StorageUploadDataRequest.Options() let request = StorageUploadDataRequest(key: key, data: data, options: options) @@ -163,10 +175,11 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { } @discardableResult - func uploadFile(key: String, - local: URL, - options: StorageUploadFileOperation.Request.Options?) -> StorageUploadFileTask - { + func uploadFile( + key: String, + local: URL, + options: StorageUploadFileOperation.Request.Options? + ) -> StorageUploadFileTask { notify("uploadFile") let options = options ?? StorageUploadFileRequest.Options() let request = StorageUploadFileRequest(key: key, local: local, options: options) @@ -260,8 +273,7 @@ class MockSecondStorageCategoryPlugin: MockStorageCategoryPlugin { } class MockStorageGetURLOperation: AmplifyOperation, - StorageGetURLOperation -{ + StorageGetURLOperation { override func pause() { } @@ -269,17 +281,19 @@ class MockStorageGetURLOperation: AmplifyOperation, StorageDownloadDataOperation { override func pause() { } @@ -288,17 +302,19 @@ StorageError } init(request: Request) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.downloadData, - request: request) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.downloadData, + request: request + ) } } class MockStorageDownloadFileOperation: AmplifyInProcessReportingOperation< -StorageDownloadFileRequest, -Progress, -Void, -StorageError + StorageDownloadFileRequest, + Progress, + Void, + StorageError >, StorageDownloadFileOperation { override func pause() { } @@ -307,17 +323,19 @@ StorageError } init(request: Request) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.downloadFile, - request: request) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.downloadFile, + request: request + ) } } class MockStorageUploadDataOperation: AmplifyInProcessReportingOperation< -StorageUploadDataRequest, -Progress, -String, -StorageError + StorageUploadDataRequest, + Progress, + String, + StorageError >, StorageUploadDataOperation { override func pause() { } @@ -326,17 +344,19 @@ StorageError } init(request: Request) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.uploadData, - request: request) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.uploadData, + request: request + ) } } class MockStorageUploadFileOperation: AmplifyInProcessReportingOperation< -StorageUploadFileRequest, -Progress, -String, -StorageError + StorageUploadFileRequest, + Progress, + String, + StorageError >, StorageUploadFileOperation { override func pause() { } @@ -345,15 +365,16 @@ StorageError } init(request: Request) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.uploadFile, - request: request) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.uploadFile, + request: request + ) } } class MockStorageRemoveOperation: AmplifyOperation, - StorageRemoveOperation -{ + StorageRemoveOperation { override func pause() { } @@ -361,15 +382,16 @@ class MockStorageRemoveOperation: AmplifyOperation, - StorageListOperation -{ + StorageListOperation { override func pause() { } @@ -377,8 +399,10 @@ class MockStorageListOperation: AmplifyOperation - public init(id: String = UUID().uuidString, - name: String, - books: List = []) - { + public init( + id: String = UUID().uuidString, + name: String, + books: List = [] + ) { self.id = id self.name = name self.books = books diff --git a/AmplifyTestCommon/Models/Associations/Book+Schema.swift b/AmplifyTestCommon/Models/Associations/Book+Schema.swift index a1dc8fcafb..54f2790c63 100644 --- a/AmplifyTestCommon/Models/Associations/Book+Schema.swift +++ b/AmplifyTestCommon/Models/Associations/Book+Schema.swift @@ -27,9 +27,11 @@ public extension Book { model.fields( .id(), .field(book.title, is: .required, ofType: .string), - .hasMany(book.authors, - ofType: BookAuthor.self, - associatedWith: BookAuthor.keys.author) + .hasMany( + book.authors, + ofType: BookAuthor.self, + associatedWith: BookAuthor.keys.author + ) ) } diff --git a/AmplifyTestCommon/Models/Associations/Book.swift b/AmplifyTestCommon/Models/Associations/Book.swift index b64e099457..49a6bee75e 100644 --- a/AmplifyTestCommon/Models/Associations/Book.swift +++ b/AmplifyTestCommon/Models/Associations/Book.swift @@ -16,10 +16,11 @@ public struct Book: Model { // hasMany(associatedWith: "book") public var authors: List - public init(id: String = UUID().uuidString, - title: String, - authors: List = []) - { + public init( + id: String = UUID().uuidString, + title: String, + authors: List = [] + ) { self.id = id self.title = title self.authors = authors diff --git a/AmplifyTestCommon/Models/Associations/BookAuthor+Schema.swift b/AmplifyTestCommon/Models/Associations/BookAuthor+Schema.swift index 967f1069a5..4856720780 100644 --- a/AmplifyTestCommon/Models/Associations/BookAuthor+Schema.swift +++ b/AmplifyTestCommon/Models/Associations/BookAuthor+Schema.swift @@ -26,12 +26,16 @@ public extension BookAuthor { model.fields( .id(), - .belongsTo(bookAuthor.book, - ofType: Book.self, - associatedWith: Book.keys.authors), - .belongsTo(bookAuthor.author, - ofType: Author.self, - associatedWith: Author.keys.books) + .belongsTo( + bookAuthor.book, + ofType: Book.self, + associatedWith: Book.keys.authors + ), + .belongsTo( + bookAuthor.author, + ofType: Author.self, + associatedWith: Author.keys.books + ) ) } diff --git a/AmplifyTestCommon/Models/Associations/BookAuthor.swift b/AmplifyTestCommon/Models/Associations/BookAuthor.swift index 02c7922595..e29875b031 100644 --- a/AmplifyTestCommon/Models/Associations/BookAuthor.swift +++ b/AmplifyTestCommon/Models/Associations/BookAuthor.swift @@ -18,10 +18,11 @@ public struct BookAuthor: Model { // belongsTo public let book: Book - public init(id: String = UUID().uuidString, - book: Book, - author: Author) - { + public init( + id: String = UUID().uuidString, + book: Book, + author: Author + ) { self.id = id self.book = book self.author = author diff --git a/AmplifyTestCommon/Models/Associations/UserAccount+Schema.swift b/AmplifyTestCommon/Models/Associations/UserAccount+Schema.swift index ce187a77fc..adf7fb3f85 100644 --- a/AmplifyTestCommon/Models/Associations/UserAccount+Schema.swift +++ b/AmplifyTestCommon/Models/Associations/UserAccount+Schema.swift @@ -25,10 +25,12 @@ public extension UserAccount { model.fields( .id(), - .hasOne(account.profile, - is: .optional, - ofType: UserProfile.self, - associatedWith: UserProfile.CodingKeys.account) + .hasOne( + account.profile, + is: .optional, + ofType: UserProfile.self, + associatedWith: UserProfile.CodingKeys.account + ) ) } diff --git a/AmplifyTestCommon/Models/Associations/UserAccount.swift b/AmplifyTestCommon/Models/Associations/UserAccount.swift index 5229cb5331..a05e352f88 100644 --- a/AmplifyTestCommon/Models/Associations/UserAccount.swift +++ b/AmplifyTestCommon/Models/Associations/UserAccount.swift @@ -20,9 +20,10 @@ public class UserAccount: Model { // hasOne(associatedWith: "account") public var profile: UserProfile? - public init(id: String = UUID().uuidString, - profile: UserProfile? = nil) - { + public init( + id: String = UUID().uuidString, + profile: UserProfile? = nil + ) { self.id = id self.profile = profile } diff --git a/AmplifyTestCommon/Models/Associations/UserProfile+Schema.swift b/AmplifyTestCommon/Models/Associations/UserProfile+Schema.swift index 3c24023562..d4e2c7ee1d 100644 --- a/AmplifyTestCommon/Models/Associations/UserProfile+Schema.swift +++ b/AmplifyTestCommon/Models/Associations/UserProfile+Schema.swift @@ -25,9 +25,11 @@ public extension UserProfile { model.fields( .id(), - .belongsTo(profile.account, - ofType: UserAccount.self, - associatedWith: UserAccount.keys.profile) + .belongsTo( + profile.account, + ofType: UserAccount.self, + associatedWith: UserAccount.keys.profile + ) ) } diff --git a/AmplifyTestCommon/Models/Associations/UserProfile.swift b/AmplifyTestCommon/Models/Associations/UserProfile.swift index fa30f14840..26d1d2e7cb 100644 --- a/AmplifyTestCommon/Models/Associations/UserProfile.swift +++ b/AmplifyTestCommon/Models/Associations/UserProfile.swift @@ -20,9 +20,10 @@ public class UserProfile: Model { // belongsTo(associatedWith: "profile") public var account: UserAccount - public init(id: String = UUID().uuidString, - account: UserAccount) - { + public init( + id: String = UUID().uuidString, + account: UserAccount + ) { self.id = id self.account = account } diff --git a/AmplifyTestCommon/Models/Collection/1/Project1+Schema.swift b/AmplifyTestCommon/Models/Collection/1/Project1+Schema.swift index 03fe1c4394..7d0aacab8b 100644 --- a/AmplifyTestCommon/Models/Collection/1/Project1+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/1/Project1+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Project1 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case team diff --git a/AmplifyTestCommon/Models/Collection/1/Project1.swift b/AmplifyTestCommon/Models/Collection/1/Project1.swift index 760c68fa7d..8760364532 100644 --- a/AmplifyTestCommon/Models/Collection/1/Project1.swift +++ b/AmplifyTestCommon/Models/Collection/1/Project1.swift @@ -14,10 +14,11 @@ public struct Project1: Model { public var name: String? public var team: Team1? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, name: String? = nil, - team: Team1? = nil) - { + team: Team1? = nil + ) { self.id = id self.name = name self.team = team diff --git a/AmplifyTestCommon/Models/Collection/1/Team1+Schema.swift b/AmplifyTestCommon/Models/Collection/1/Team1+Schema.swift index ffc1524b32..946b4692c0 100644 --- a/AmplifyTestCommon/Models/Collection/1/Team1+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/1/Team1+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Team1 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name } diff --git a/AmplifyTestCommon/Models/Collection/1/Team1.swift b/AmplifyTestCommon/Models/Collection/1/Team1.swift index 35e80b301c..0bcf352358 100644 --- a/AmplifyTestCommon/Models/Collection/1/Team1.swift +++ b/AmplifyTestCommon/Models/Collection/1/Team1.swift @@ -13,9 +13,10 @@ public struct Team1: Model { public let id: String public var name: String - public init(id: String = UUID().uuidString, - name: String) - { + public init( + id: String = UUID().uuidString, + name: String + ) { self.id = id self.name = name } diff --git a/AmplifyTestCommon/Models/Collection/2/Project2+Schema.swift b/AmplifyTestCommon/Models/Collection/2/Project2+Schema.swift index f84a28fab3..837b30544e 100644 --- a/AmplifyTestCommon/Models/Collection/2/Project2+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/2/Project2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Project2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case teamID diff --git a/AmplifyTestCommon/Models/Collection/2/Project2.swift b/AmplifyTestCommon/Models/Collection/2/Project2.swift index 1646709631..0dbc730331 100644 --- a/AmplifyTestCommon/Models/Collection/2/Project2.swift +++ b/AmplifyTestCommon/Models/Collection/2/Project2.swift @@ -15,11 +15,12 @@ public struct Project2: Model { public var teamID: String public var team: Team2? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, name: String? = nil, teamID: String, - team: Team2? = nil) - { + team: Team2? = nil + ) { self.id = id self.name = name self.teamID = teamID diff --git a/AmplifyTestCommon/Models/Collection/2/Team2+Schema.swift b/AmplifyTestCommon/Models/Collection/2/Team2+Schema.swift index 242b488781..4e97ad88c6 100644 --- a/AmplifyTestCommon/Models/Collection/2/Team2+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/2/Team2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Team2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name } diff --git a/AmplifyTestCommon/Models/Collection/2/Team2.swift b/AmplifyTestCommon/Models/Collection/2/Team2.swift index e02590b475..7c3b6617a8 100644 --- a/AmplifyTestCommon/Models/Collection/2/Team2.swift +++ b/AmplifyTestCommon/Models/Collection/2/Team2.swift @@ -13,9 +13,10 @@ public struct Team2: Model { public let id: String public var name: String - public init(id: String = UUID().uuidString, - name: String) - { + public init( + id: String = UUID().uuidString, + name: String + ) { self.id = id self.name = name } diff --git a/AmplifyTestCommon/Models/Collection/3/Comment3+Schema.swift b/AmplifyTestCommon/Models/Collection/3/Comment3+Schema.swift index 4568dbb0a5..f2be1939c8 100644 --- a/AmplifyTestCommon/Models/Collection/3/Comment3+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/3/Comment3+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment3 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case postID case content diff --git a/AmplifyTestCommon/Models/Collection/3/Comment3.swift b/AmplifyTestCommon/Models/Collection/3/Comment3.swift index b799be9229..14c2cce660 100644 --- a/AmplifyTestCommon/Models/Collection/3/Comment3.swift +++ b/AmplifyTestCommon/Models/Collection/3/Comment3.swift @@ -14,10 +14,11 @@ public struct Comment3: Model { public var postID: String public var content: String - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, postID: String, - content: String) - { + content: String + ) { self.id = id self.postID = postID self.content = content diff --git a/AmplifyTestCommon/Models/Collection/3/Post3+Schema.swift b/AmplifyTestCommon/Models/Collection/3/Post3+Schema.swift index 0293e0dc69..fbda57a013 100644 --- a/AmplifyTestCommon/Models/Collection/3/Post3+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/3/Post3+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post3 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case comments diff --git a/AmplifyTestCommon/Models/Collection/3/Post3.swift b/AmplifyTestCommon/Models/Collection/3/Post3.swift index 3e5e2828b1..63d64a9316 100644 --- a/AmplifyTestCommon/Models/Collection/3/Post3.swift +++ b/AmplifyTestCommon/Models/Collection/3/Post3.swift @@ -14,10 +14,11 @@ public struct Post3: Model { public var title: String public var comments: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, title: String, - comments: List? = []) - { + comments: List? = [] + ) { self.id = id self.title = title self.comments = comments diff --git a/AmplifyTestCommon/Models/Collection/4/Comment4+Schema.swift b/AmplifyTestCommon/Models/Collection/4/Comment4+Schema.swift index d932301c73..35b7c9278c 100644 --- a/AmplifyTestCommon/Models/Collection/4/Comment4+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/4/Comment4+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment4 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case post diff --git a/AmplifyTestCommon/Models/Collection/4/Comment4.swift b/AmplifyTestCommon/Models/Collection/4/Comment4.swift index 15e2ef6de7..5a18637a57 100644 --- a/AmplifyTestCommon/Models/Collection/4/Comment4.swift +++ b/AmplifyTestCommon/Models/Collection/4/Comment4.swift @@ -19,10 +19,11 @@ public struct Comment4: Model { } } - public init(id: String = UUID().uuidString, - content: String, - post: Post4? = nil) - { + public init( + id: String = UUID().uuidString, + content: String, + post: Post4? = nil + ) { self.id = id self.content = content self._post = LazyReference(post) diff --git a/AmplifyTestCommon/Models/Collection/4/Post4+Schema.swift b/AmplifyTestCommon/Models/Collection/4/Post4+Schema.swift index 4cfe72c1d9..ac5c751832 100644 --- a/AmplifyTestCommon/Models/Collection/4/Post4+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/4/Post4+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post4 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case comments diff --git a/AmplifyTestCommon/Models/Collection/4/Post4.swift b/AmplifyTestCommon/Models/Collection/4/Post4.swift index d1d66e8f4a..84fc6972ba 100644 --- a/AmplifyTestCommon/Models/Collection/4/Post4.swift +++ b/AmplifyTestCommon/Models/Collection/4/Post4.swift @@ -14,10 +14,11 @@ public struct Post4: Model { public var title: String public var comments: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, title: String, - comments: List? = []) - { + comments: List? = [] + ) { self.id = id self.title = title self.comments = comments diff --git a/AmplifyTestCommon/Models/Collection/5/Post5+Schema.swift b/AmplifyTestCommon/Models/Collection/5/Post5+Schema.swift index 54069a26fd..419ffc556d 100644 --- a/AmplifyTestCommon/Models/Collection/5/Post5+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/5/Post5+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post5 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case editors diff --git a/AmplifyTestCommon/Models/Collection/5/Post5.swift b/AmplifyTestCommon/Models/Collection/5/Post5.swift index 97648c1653..d4f8fc51fa 100644 --- a/AmplifyTestCommon/Models/Collection/5/Post5.swift +++ b/AmplifyTestCommon/Models/Collection/5/Post5.swift @@ -14,10 +14,11 @@ public struct Post5: Model { public var title: String public var editors: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, title: String, - editors: List? = []) - { + editors: List? = [] + ) { self.id = id self.title = title self.editors = editors diff --git a/AmplifyTestCommon/Models/Collection/5/PostEditor5+Schema.swift b/AmplifyTestCommon/Models/Collection/5/PostEditor5+Schema.swift index cb0b07f565..2d054312a0 100644 --- a/AmplifyTestCommon/Models/Collection/5/PostEditor5+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/5/PostEditor5+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension PostEditor5 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case post case editor diff --git a/AmplifyTestCommon/Models/Collection/5/PostEditor5.swift b/AmplifyTestCommon/Models/Collection/5/PostEditor5.swift index 8988103eeb..30af2f8558 100644 --- a/AmplifyTestCommon/Models/Collection/5/PostEditor5.swift +++ b/AmplifyTestCommon/Models/Collection/5/PostEditor5.swift @@ -14,10 +14,11 @@ public struct PostEditor5: Model { public var post: Post5 public var editor: User5 - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, post: Post5, - editor: User5) - { + editor: User5 + ) { self.id = id self.post = post self.editor = editor diff --git a/AmplifyTestCommon/Models/Collection/5/User5+Schema.swift b/AmplifyTestCommon/Models/Collection/5/User5+Schema.swift index d698f06731..431a0027db 100644 --- a/AmplifyTestCommon/Models/Collection/5/User5+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/5/User5+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension User5 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case username case posts diff --git a/AmplifyTestCommon/Models/Collection/5/User5.swift b/AmplifyTestCommon/Models/Collection/5/User5.swift index 02d3c1d018..63e5ad8478 100644 --- a/AmplifyTestCommon/Models/Collection/5/User5.swift +++ b/AmplifyTestCommon/Models/Collection/5/User5.swift @@ -14,10 +14,11 @@ public struct User5: Model { public var username: String public var posts: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, username: String, - posts: List? = []) - { + posts: List? = [] + ) { self.id = id self.username = username self.posts = posts diff --git a/AmplifyTestCommon/Models/Collection/6/Blog6+Schema.swift b/AmplifyTestCommon/Models/Collection/6/Blog6+Schema.swift index 1cb72abaaa..af044289e0 100644 --- a/AmplifyTestCommon/Models/Collection/6/Blog6+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/6/Blog6+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Blog6 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case posts diff --git a/AmplifyTestCommon/Models/Collection/6/Blog6.swift b/AmplifyTestCommon/Models/Collection/6/Blog6.swift index b337a69c23..d226a82190 100644 --- a/AmplifyTestCommon/Models/Collection/6/Blog6.swift +++ b/AmplifyTestCommon/Models/Collection/6/Blog6.swift @@ -14,10 +14,11 @@ public struct Blog6: Model { public var name: String public var posts: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, name: String, - posts: List? = []) - { + posts: List? = [] + ) { self.id = id self.name = name self.posts = posts diff --git a/AmplifyTestCommon/Models/Collection/6/Comment6+Schema.swift b/AmplifyTestCommon/Models/Collection/6/Comment6+Schema.swift index 8eca92671b..ef05fae7ca 100644 --- a/AmplifyTestCommon/Models/Collection/6/Comment6+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/6/Comment6+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment6 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case post case content diff --git a/AmplifyTestCommon/Models/Collection/6/Comment6.swift b/AmplifyTestCommon/Models/Collection/6/Comment6.swift index 1d0b3e574e..960b55edd1 100644 --- a/AmplifyTestCommon/Models/Collection/6/Comment6.swift +++ b/AmplifyTestCommon/Models/Collection/6/Comment6.swift @@ -14,10 +14,11 @@ public struct Comment6: Model { public var post: Post6? public var content: String - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, post: Post6? = nil, - content: String) - { + content: String + ) { self.id = id self.post = post self.content = content diff --git a/AmplifyTestCommon/Models/Collection/6/Post6+Schema.swift b/AmplifyTestCommon/Models/Collection/6/Post6+Schema.swift index d5ccd4cbf7..24956ef8f6 100644 --- a/AmplifyTestCommon/Models/Collection/6/Post6+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/6/Post6+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post6 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case blog diff --git a/AmplifyTestCommon/Models/Collection/6/Post6.swift b/AmplifyTestCommon/Models/Collection/6/Post6.swift index 33840ae236..122eebf379 100644 --- a/AmplifyTestCommon/Models/Collection/6/Post6.swift +++ b/AmplifyTestCommon/Models/Collection/6/Post6.swift @@ -15,11 +15,12 @@ public struct Post6: Model { public var blog: Blog6? public var comments: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, title: String, blog: Blog6? = nil, - comments: List? = []) - { + comments: List? = [] + ) { self.id = id self.title = title self.blog = blog diff --git a/AmplifyTestCommon/Models/Comment+Schema.swift b/AmplifyTestCommon/Models/Comment+Schema.swift index 8879a10823..b4395dc4b5 100644 --- a/AmplifyTestCommon/Models/Comment+Schema.swift +++ b/AmplifyTestCommon/Models/Comment+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case createdAt diff --git a/AmplifyTestCommon/Models/Comment.swift b/AmplifyTestCommon/Models/Comment.swift index 97d1dde767..77e6c97d2a 100644 --- a/AmplifyTestCommon/Models/Comment.swift +++ b/AmplifyTestCommon/Models/Comment.swift @@ -20,11 +20,12 @@ public struct Comment: Model { } } - public init(id: String = UUID().uuidString, - content: String, - createdAt: Temporal.DateTime, - post: Post) - { + public init( + id: String = UUID().uuidString, + content: String, + createdAt: Temporal.DateTime, + post: Post + ) { self.id = id self.content = content self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey+Schema.swift index 439e00f439..669e370130 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension CommentWithCompositeKey { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case post @@ -49,9 +48,10 @@ extension CommentWithCompositeKey: ModelIdentifiable { } public extension CommentWithCompositeKey.IdentifierProtocol { - static func identifier(id: String, - content: String) -> Self - { + static func identifier( + id: String, + content: String + ) -> Self { .make(fields: [(name: "id", value: id), (name: "content", value: content)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey.swift index 3c24d4c559..e634f7e71a 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey.swift @@ -16,22 +16,26 @@ public struct CommentWithCompositeKey: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - content: String, - post: PostWithCompositeKey? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String, + post: PostWithCompositeKey? = nil + ) { + self.init( + id: id, content: content, post: post, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - content: String, - post: PostWithCompositeKey? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + content: String, + post: PostWithCompositeKey? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.post = post diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex+Schema.swift index 859e039156..fae7029627 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension CommentWithCompositeKeyAndIndex { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case post @@ -50,9 +49,10 @@ extension CommentWithCompositeKeyAndIndex: ModelIdentifiable { } public extension CommentWithCompositeKeyAndIndex.IdentifierProtocol { - static func identifier(id: String, - content: String) -> Self - { + static func identifier( + id: String, + content: String + ) -> Self { .make(fields: [(name: "id", value: id), (name: "content", value: content)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex.swift index c44267c1c6..595f98fa30 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex.swift @@ -16,22 +16,26 @@ public struct CommentWithCompositeKeyAndIndex: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - content: String, - post: PostWithCompositeKeyAndIndex? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String, + post: PostWithCompositeKeyAndIndex? = nil + ) { + self.init( + id: id, content: content, post: post, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - content: String, - post: PostWithCompositeKeyAndIndex? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + content: String, + post: PostWithCompositeKeyAndIndex? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.post = post diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional+Schema.swift index 13e411e09e..4db364f449 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension CommentWithCompositeKeyUnidirectional { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case createdAt @@ -51,9 +50,10 @@ extension CommentWithCompositeKeyUnidirectional: ModelIdentifiable { } public extension CommentWithCompositeKeyUnidirectional.IdentifierProtocol { - static func identifier(id: String, - content: String) -> Self - { + static func identifier( + id: String, + content: String + ) -> Self { .make(fields: [(name: "id", value: id), (name: "content", value: content)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional.swift index b4b414e54d..d3ea55a904 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional.swift @@ -17,25 +17,29 @@ public struct CommentWithCompositeKeyUnidirectional: Model { public var postWithCompositeKeyUnidirectionalCommentsId: String? public var postWithCompositeKeyUnidirectionalCommentsTitle: String? - public init(id: String = UUID().uuidString, - content: String, - post21CommentsId: String? = nil, - post21CommentsTitle: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String, + post21CommentsId: String? = nil, + post21CommentsTitle: String? = nil + ) { + self.init( + id: id, content: content, createdAt: nil, updatedAt: nil, postWithCompositeKeyUnidirectionalCommentsId: post21CommentsId, - postWithCompositeKeyUnidirectionalCommentsTitle: post21CommentsTitle) + postWithCompositeKeyUnidirectionalCommentsTitle: post21CommentsTitle + ) } - init(id: String = UUID().uuidString, - content: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - postWithCompositeKeyUnidirectionalCommentsId: String? = nil, - postWithCompositeKeyUnidirectionalCommentsTitle: String? = nil) - { + init( + id: String = UUID().uuidString, + content: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + postWithCompositeKeyUnidirectionalCommentsId: String? = nil, + postWithCompositeKeyUnidirectionalCommentsTitle: String? = nil + ) { self.id = id self.content = content self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk+Schema.swift index 6027443328..668ee06320 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ModelCompositeIntPk { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case serial case createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk.swift index f3751e7a1e..1af43fb97a 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk.swift @@ -15,19 +15,23 @@ public struct ModelCompositeIntPk: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - serial: Int) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + serial: Int + ) { + self.init( + id: id, serial: serial, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - serial: Int, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + serial: Int, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.serial = serial self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk+Schema.swift index beca197698..05f6abd46e 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ModelCompositePk { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case dob case name @@ -33,11 +32,11 @@ public extension ModelCompositePk { ) model.fields( - .field(modelCompositePk.id, is: .required, ofType: .string), - .field(modelCompositePk.dob, is: .required, ofType: .dateTime), - .field(modelCompositePk.name, is: .optional, ofType: .string), - .field(modelCompositePk.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), - .field(modelCompositePk.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) + .field(modelCompositePk.id, is: .required, ofType: .string), + .field(modelCompositePk.dob, is: .required, ofType: .dateTime), + .field(modelCompositePk.name, is: .optional, ofType: .string), + .field(modelCompositePk.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), + .field(modelCompositePk.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk.swift index 13571b5654..98ce1635fa 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk.swift @@ -16,22 +16,26 @@ public struct ModelCompositePk: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - name: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + name: String? = nil + ) { + self.init( + id: id, dob: dob, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - name: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + name: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.dob = dob self.name = name diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo+Schema.swift index 5985f5701b..15d8123b26 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ModelCompositePkBelongsTo { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case dob case owner @@ -34,17 +33,20 @@ public extension ModelCompositePkBelongsTo { ) model.fields( - .field(modelCompositePkBelongsTo.id, is: .required, ofType: .string), - .field(modelCompositePkBelongsTo.dob, is: .required, ofType: .dateTime), - .field(modelCompositePkBelongsTo.name, is: .optional, ofType: .string), - .belongsTo(modelCompositePkBelongsTo.owner, is: .optional, - ofType: ModelCompositePkWithAssociation.self, - targetNames: [ - "modelCompositePkWithAssociationOtherModelsId", - "modelCompositePkWithAssociationOtherModelsDob" - ]), - .field(modelCompositePkBelongsTo.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), - .field(modelCompositePkBelongsTo.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) + .field(modelCompositePkBelongsTo.id, is: .required, ofType: .string), + .field(modelCompositePkBelongsTo.dob, is: .required, ofType: .dateTime), + .field(modelCompositePkBelongsTo.name, is: .optional, ofType: .string), + .belongsTo( + modelCompositePkBelongsTo.owner, + is: .optional, + ofType: ModelCompositePkWithAssociation.self, + targetNames: [ + "modelCompositePkWithAssociationOtherModelsId", + "modelCompositePkWithAssociationOtherModelsDob" + ] + ), + .field(modelCompositePkBelongsTo.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), + .field(modelCompositePkBelongsTo.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo.swift index 978eba0d68..8d9963a420 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo.swift @@ -17,25 +17,29 @@ public struct ModelCompositePkBelongsTo: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - name: String? = nil, - owner: ModelCompositePkWithAssociation? = nil) - { - self.init(id: id, - dob: dob, - name: name, - owner: owner, - createdAt: nil, - updatedAt: nil) + public init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + name: String? = nil, + owner: ModelCompositePkWithAssociation? = nil + ) { + self.init( + id: id, + dob: dob, + name: name, + owner: owner, + createdAt: nil, + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - name: String? = nil, - owner: ModelCompositePkWithAssociation? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + name: String? = nil, + owner: ModelCompositePkWithAssociation? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.dob = dob self.name = name diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation+Schema.swift index 08d08c91b8..cec7e1c3e9 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ModelCompositePkWithAssociation { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case dob case name @@ -34,15 +33,17 @@ public extension ModelCompositePkWithAssociation { ) model.fields( - .field(modelCompositePkWithAssociation.id, is: .required, ofType: .string), - .field(modelCompositePkWithAssociation.dob, is: .required, ofType: .dateTime), - .field(modelCompositePkWithAssociation.name, is: .optional, ofType: .string), - .hasMany(modelCompositePkWithAssociation.otherModels, - is: .optional, - ofType: ModelCompositePkBelongsTo.self, - associatedWith: ModelCompositePkBelongsTo.keys.owner), - .field(modelCompositePkWithAssociation.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), - .field(modelCompositePkWithAssociation.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) + .field(modelCompositePkWithAssociation.id, is: .required, ofType: .string), + .field(modelCompositePkWithAssociation.dob, is: .required, ofType: .dateTime), + .field(modelCompositePkWithAssociation.name, is: .optional, ofType: .string), + .hasMany( + modelCompositePkWithAssociation.otherModels, + is: .optional, + ofType: ModelCompositePkBelongsTo.self, + associatedWith: ModelCompositePkBelongsTo.keys.owner + ), + .field(modelCompositePkWithAssociation.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), + .field(modelCompositePkWithAssociation.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation.swift index bafa9a013d..ece232844f 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation.swift @@ -17,25 +17,29 @@ public struct ModelCompositePkWithAssociation: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - name: String? = nil, - otherModels: List? = []) - { - self.init(id: id, - dob: dob, - name: name, - otherModels: otherModels, - createdAt: nil, - updatedAt: nil) + public init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + name: String? = nil, + otherModels: List? = [] + ) { + self.init( + id: id, + dob: dob, + name: name, + otherModels: otherModels, + createdAt: nil, + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - name: String? = nil, - otherModels: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + name: String? = nil, + otherModels: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.dob = dob self.name = name diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPKDefined.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPKDefined.swift index 3fda821de3..e658cbc193 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPKDefined.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPKDefined.swift @@ -16,22 +16,26 @@ public struct ModelCustomPkDefined: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - name: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + name: String? = nil + ) { + self.init( + id: id, dob: dob, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - name: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + name: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.dob = dob self.name = name diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPkDefined+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPkDefined+Schema.swift index 46f41f2031..11809bb3f1 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPkDefined+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPkDefined+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ModelCustomPkDefined { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case dob case name diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk+Schema.swift index 95d6f4d317..e357caf01b 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ModelExplicitCustomPk { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case userId case name case createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk.swift index 3e197b7a68..ac88946c3c 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk.swift @@ -16,16 +16,19 @@ public struct ModelExplicitCustomPk: Model { public var updatedAt: Temporal.DateTime? public init(userId: String, name: String? = nil) { - self.init(userId: userId, - name: name, - createdAt: nil, - updatedAt: nil) + self.init( + userId: userId, + name: name, + createdAt: nil, + updatedAt: nil + ) } - init(userId: String, - name: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + userId: String, + name: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.userId = userId self.name = name self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk+Schema.swift index 543d116a12..fda645c5ba 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ModelExplicitDefaultPk { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk.swift index a166370ac9..880c718eff 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk.swift @@ -15,19 +15,23 @@ public struct ModelExplicitDefaultPk: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String? = nil + ) { + self.init( + id: id, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk+Schema.swift index b9a36425d6..c92e102327 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ModelImplicitDefaultPk { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk.swift index 12c45ddc38..69fa2b17dc 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk.swift @@ -15,19 +15,23 @@ public struct ModelImplicitDefaultPk: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String? = nil + ) { + self.init( + id: id, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey+Schema.swift index b9ed258200..f33472de51 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension PostTagsWithCompositeKey { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case postWithTagsCompositeKey case tagWithCompositeKey diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey.swift index 278448b077..9bf3f2b9e0 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey.swift @@ -16,22 +16,26 @@ public struct PostTagsWithCompositeKey: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - postWithTagsCompositeKey: PostWithTagsCompositeKey, - tagWithCompositeKey: TagWithCompositeKey) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + postWithTagsCompositeKey: PostWithTagsCompositeKey, + tagWithCompositeKey: TagWithCompositeKey + ) { + self.init( + id: id, postWithTagsCompositeKey: postWithTagsCompositeKey, tagWithCompositeKey: tagWithCompositeKey, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - postWithTagsCompositeKey: PostWithTagsCompositeKey, - tagWithCompositeKey: TagWithCompositeKey, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + postWithTagsCompositeKey: PostWithTagsCompositeKey, + tagWithCompositeKey: TagWithCompositeKey, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.postWithTagsCompositeKey = postWithTagsCompositeKey self.tagWithCompositeKey = tagWithCompositeKey diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey+Schema.swift index b5765f842d..9a89d20bfe 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension PostWithCompositeKey { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case comments @@ -49,9 +48,10 @@ extension PostWithCompositeKey: ModelIdentifiable { } public extension PostWithCompositeKey.IdentifierProtocol { - static func identifier(id: String, - title: String) -> Self - { + static func identifier( + id: String, + title: String + ) -> Self { .make(fields: [(name: "id", value: id), (name: "title", value: title)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey.swift index 9cde114f09..ac441cae5d 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey.swift @@ -16,22 +16,26 @@ public struct PostWithCompositeKey: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex+Schema.swift index 8c8fbefcda..16b1d5f5c1 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension PostWithCompositeKeyAndIndex { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case comments @@ -49,9 +48,10 @@ extension PostWithCompositeKeyAndIndex: ModelIdentifiable { } public extension PostWithCompositeKeyAndIndex.IdentifierProtocol { - static func identifier(id: String, - title: String) -> Self - { + static func identifier( + id: String, + title: String + ) -> Self { .make(fields: [(name: "id", value: id), (name: "title", value: title)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex.swift index f9e95f5fd9..f190c30706 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex.swift @@ -16,22 +16,26 @@ public struct PostWithCompositeKeyAndIndex: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional+Schema.swift index 5e3ea9c581..644cc6a816 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension PostWithCompositeKeyUnidirectional { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case comments @@ -36,10 +35,12 @@ public extension PostWithCompositeKeyUnidirectional { model.fields( .field(postWithCompositeKeyUnidirectional.id, is: .required, ofType: .string), .field(postWithCompositeKeyUnidirectional.title, is: .required, ofType: .string), - .hasMany(postWithCompositeKeyUnidirectional.comments, - is: .optional, - ofType: CommentWithCompositeKeyUnidirectional.self, - associatedWith: CommentWithCompositeKeyUnidirectional.keys.postWithCompositeKeyUnidirectionalCommentsId), + .hasMany( + postWithCompositeKeyUnidirectional.comments, + is: .optional, + ofType: CommentWithCompositeKeyUnidirectional.self, + associatedWith: CommentWithCompositeKeyUnidirectional.keys.postWithCompositeKeyUnidirectionalCommentsId + ), .field(postWithCompositeKeyUnidirectional.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), .field(postWithCompositeKeyUnidirectional.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) @@ -52,9 +53,10 @@ extension PostWithCompositeKeyUnidirectional: ModelIdentifiable { } public extension PostWithCompositeKeyUnidirectional.IdentifierProtocol { - static func identifier(id: String, - title: String) -> Self - { + static func identifier( + id: String, + title: String + ) -> Self { .make(fields: [(name: "id", value: id), (name: "title", value: title)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional.swift index 2b7d94426a..822c27b88e 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional.swift @@ -16,22 +16,26 @@ public struct PostWithCompositeKeyUnidirectional: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey+Schema.swift index 4ab74d79f1..c2d50bd16a 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension PostWithTagsCompositeKey { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case postId case title case tags @@ -49,9 +48,10 @@ extension PostWithTagsCompositeKey: ModelIdentifiable { } public extension PostWithTagsCompositeKey.IdentifierProtocol { - static func identifier(postId: String, - title: String) -> Self - { + static func identifier( + postId: String, + title: String + ) -> Self { .make(fields: [(name: "postId", value: postId), (name: "title", value: title)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey.swift index b4445634f8..73e3e3cd7c 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey.swift @@ -16,22 +16,26 @@ public struct PostWithTagsCompositeKey: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(postId: String, - title: String, - tags: List? = []) - { - self.init(postId: postId, + public init( + postId: String, + title: String, + tags: List? = [] + ) { + self.init( + postId: postId, title: title, tags: tags, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(postId: String, - title: String, - tags: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + postId: String, + title: String, + tags: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.postId = postId self.title = title self.tags = tags diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey+Schema.swift index b7faf654fc..9332ae93d1 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension TagWithCompositeKey { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case posts @@ -49,9 +48,10 @@ extension TagWithCompositeKey: ModelIdentifiable { } public extension TagWithCompositeKey.IdentifierProtocol { - static func identifier(id: String, - name: String) -> Self - { + static func identifier( + id: String, + name: String + ) -> Self { .make(fields: [(name: "id", value: id), (name: "name", value: name)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey.swift index b621d63c3d..b913c944db 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey.swift @@ -16,22 +16,26 @@ public struct TagWithCompositeKey: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String, - posts: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String, + posts: List? = [] + ) { + self.init( + id: id, name: name, posts: posts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - posts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + posts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.posts = posts diff --git a/AmplifyTestCommon/Models/CustomerOrder+Schema.swift b/AmplifyTestCommon/Models/CustomerOrder+Schema.swift index b5e15f4ad9..a72bfa93f0 100644 --- a/AmplifyTestCommon/Models/CustomerOrder+Schema.swift +++ b/AmplifyTestCommon/Models/CustomerOrder+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension CustomerOrder { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case orderId case email diff --git a/AmplifyTestCommon/Models/CustomerOrder.swift b/AmplifyTestCommon/Models/CustomerOrder.swift index 521794fcc1..2e3472728a 100644 --- a/AmplifyTestCommon/Models/CustomerOrder.swift +++ b/AmplifyTestCommon/Models/CustomerOrder.swift @@ -22,10 +22,11 @@ public struct CustomerOrder: Model { public var orderId: String public var email: String - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, orderId: String, - email: String) - { + email: String + ) { self.id = id self.orderId = orderId self.email = email diff --git a/AmplifyTestCommon/Models/Deprecated/DeprecatedTodo.swift b/AmplifyTestCommon/Models/Deprecated/DeprecatedTodo.swift index 80b368a696..53a88d40c5 100644 --- a/AmplifyTestCommon/Models/Deprecated/DeprecatedTodo.swift +++ b/AmplifyTestCommon/Models/Deprecated/DeprecatedTodo.swift @@ -31,10 +31,11 @@ public struct DeprecatedTodo: Model { public var description: String? public var note: Note? - public init(id: String = UUID().uuidString, - description: String? = nil, - note: Note? = nil) - { + public init( + id: String = UUID().uuidString, + description: String? = nil, + note: Note? = nil + ) { self.id = id self.description = description self.note = note @@ -43,8 +44,7 @@ public struct DeprecatedTodo: Model { public extension DeprecatedTodo { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case description case note diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost+Schema.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost+Schema.swift index 4071577e07..c9a94931a5 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost+Schema.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension M2MPost { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case editors diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost.swift index 7317a08327..12862030b3 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost.swift @@ -14,10 +14,11 @@ public struct M2MPost: Model { public var title: String public var editors: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, title: String, - editors: List? = []) - { + editors: List? = [] + ) { self.id = id self.title = title self.editors = editors diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor+Schema.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor+Schema.swift index 74e00b969a..d37c0719cb 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor+Schema.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension M2MPostEditor { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case post case editor diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor.swift index 42fba8f759..2cfd57b223 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor.swift @@ -14,10 +14,11 @@ public struct M2MPostEditor: Model { public var post: M2MPost public var editor: M2MUser - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, post: M2MPost, - editor: M2MUser) - { + editor: M2MUser + ) { self.id = id self.post = post self.editor = editor diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser+Schema.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser+Schema.swift index afb297da42..1db74f78b5 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser+Schema.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension M2MUser { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case username case posts diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser.swift index a42166a34a..4c62eb0f75 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser.swift @@ -14,10 +14,11 @@ public struct M2MUser: Model { public var username: String public var posts: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, username: String, - posts: List? = []) - { + posts: List? = [] + ) { self.id = id self.username = username self.posts = posts diff --git a/AmplifyTestCommon/Models/NonModel/Category.swift b/AmplifyTestCommon/Models/NonModel/Category.swift index 13ce40cc2c..3f5375f2db 100644 --- a/AmplifyTestCommon/Models/NonModel/Category.swift +++ b/AmplifyTestCommon/Models/NonModel/Category.swift @@ -25,7 +25,9 @@ public extension Category { static let schema = defineSchema { embedded in let category = Category.keys - embedded.fields(.field(category.name, is: .required, ofType: .string), - .field(category.color, is: .required, ofType: .embedded(type: Color.self))) + embedded.fields( + .field(category.name, is: .required, ofType: .string), + .field(category.color, is: .required, ofType: .embedded(type: Color.self)) + ) } } diff --git a/AmplifyTestCommon/Models/NonModel/Color.swift b/AmplifyTestCommon/Models/NonModel/Color.swift index b4d534ea82..be00159e03 100644 --- a/AmplifyTestCommon/Models/NonModel/Color.swift +++ b/AmplifyTestCommon/Models/NonModel/Color.swift @@ -28,9 +28,11 @@ public extension Color { static let schema = defineSchema { embedded in let color = Color.keys - embedded.fields(.field(color.name, is: .required, ofType: .string), - .field(color.red, is: .required, ofType: .int), - .field(color.green, is: .required, ofType: .int), - .field(color.blue, is: .required, ofType: .int)) + embedded.fields( + .field(color.name, is: .required, ofType: .string), + .field(color.red, is: .required, ofType: .int), + .field(color.green, is: .required, ofType: .int), + .field(color.blue, is: .required, ofType: .int) + ) } } diff --git a/AmplifyTestCommon/Models/NonModel/DynamicEmbedded.swift b/AmplifyTestCommon/Models/NonModel/DynamicEmbedded.swift index 1ee5997d5e..dbe3743464 100644 --- a/AmplifyTestCommon/Models/NonModel/DynamicEmbedded.swift +++ b/AmplifyTestCommon/Models/NonModel/DynamicEmbedded.swift @@ -51,8 +51,7 @@ struct DynamicEmbedded: Embeddable, JSONValueHolder { public func jsonValue(for key: String, modelSchema: ModelSchema) -> Any?? { let field = modelSchema.field(withName: key) if case .int = field?.type, - case .some(.number(let deserializedValue)) = values[key] - { + case .some(.number(let deserializedValue)) = values[key] { return Int(deserializedValue) } return jsonValue(for: key) diff --git a/AmplifyTestCommon/Models/NonModel/DynamicModel.swift b/AmplifyTestCommon/Models/NonModel/DynamicModel.swift index 44135ba27b..c2207d7e1d 100644 --- a/AmplifyTestCommon/Models/NonModel/DynamicModel.swift +++ b/AmplifyTestCommon/Models/NonModel/DynamicModel.swift @@ -60,8 +60,7 @@ struct DynamicModel: Model, JSONValueHolder { public func jsonValue(for key: String, modelSchema: ModelSchema) -> Any?? { let field = modelSchema.field(withName: key) if case .int = field?.type, - case .some(.number(let deserializedValue)) = values[key] - { + case .some(.number(let deserializedValue)) = values[key] { return Int(deserializedValue) } return jsonValue(for: key) diff --git a/AmplifyTestCommon/Models/NonModel/Section.swift b/AmplifyTestCommon/Models/NonModel/Section.swift index 893f9b02c0..2686d17849 100644 --- a/AmplifyTestCommon/Models/NonModel/Section.swift +++ b/AmplifyTestCommon/Models/NonModel/Section.swift @@ -24,7 +24,9 @@ public extension Section { static let schema = defineSchema { embedded in let section = Section.keys - embedded.fields(.field(section.name, is: .required, ofType: .string), - .field(section.number, is: .required, ofType: .double)) + embedded.fields( + .field(section.name, is: .required, ofType: .string), + .field(section.number, is: .required, ofType: .double) + ) } } diff --git a/AmplifyTestCommon/Models/NonModel/Todo+Schema.swift b/AmplifyTestCommon/Models/NonModel/Todo+Schema.swift index a274488025..75a2e93363 100644 --- a/AmplifyTestCommon/Models/NonModel/Todo+Schema.swift +++ b/AmplifyTestCommon/Models/NonModel/Todo+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Todo { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case description diff --git a/AmplifyTestCommon/Models/NonModel/Todo.swift b/AmplifyTestCommon/Models/NonModel/Todo.swift index 62de6f8d6e..58eb250fcf 100644 --- a/AmplifyTestCommon/Models/NonModel/Todo.swift +++ b/AmplifyTestCommon/Models/NonModel/Todo.swift @@ -46,13 +46,14 @@ public struct Todo: Model { public var section: Section? public var stickies: [String]? - public init(id: String = UUID().uuidString, - name: String, - description: String? = nil, - categories: [Category]? = [], - section: Section? = nil, - stickies: [String]? = []) - { + public init( + id: String = UUID().uuidString, + name: String, + description: String? = nil, + categories: [Category]? = [], + section: Section? = nil, + stickies: [String]? = [] + ) { self.id = id self.name = name self.description = description diff --git a/AmplifyTestCommon/Models/OGCScenarioBMGroupPost+Schema.swift b/AmplifyTestCommon/Models/OGCScenarioBMGroupPost+Schema.swift index 8dd439f20f..9a31e531e8 100644 --- a/AmplifyTestCommon/Models/OGCScenarioBMGroupPost+Schema.swift +++ b/AmplifyTestCommon/Models/OGCScenarioBMGroupPost+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension OGCScenarioBMGroupPost { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case owner diff --git a/AmplifyTestCommon/Models/OGCScenarioBMGroupPost.swift b/AmplifyTestCommon/Models/OGCScenarioBMGroupPost.swift index b1c6783b35..7b07808b60 100644 --- a/AmplifyTestCommon/Models/OGCScenarioBMGroupPost.swift +++ b/AmplifyTestCommon/Models/OGCScenarioBMGroupPost.swift @@ -14,10 +14,11 @@ public struct OGCScenarioBMGroupPost: Model { public var title: String public var owner: String? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, title: String, - owner: String? = nil) - { + owner: String? = nil + ) { self.id = id self.title = title self.owner = owner diff --git a/AmplifyTestCommon/Models/OGCScenarioBPost+Schema.swift b/AmplifyTestCommon/Models/OGCScenarioBPost+Schema.swift index 5f5aef170b..bf69f585ca 100644 --- a/AmplifyTestCommon/Models/OGCScenarioBPost+Schema.swift +++ b/AmplifyTestCommon/Models/OGCScenarioBPost+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension OGCScenarioBPost { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case owner diff --git a/AmplifyTestCommon/Models/OGCScenarioBPost.swift b/AmplifyTestCommon/Models/OGCScenarioBPost.swift index fa98a24586..b49ef50072 100644 --- a/AmplifyTestCommon/Models/OGCScenarioBPost.swift +++ b/AmplifyTestCommon/Models/OGCScenarioBPost.swift @@ -14,10 +14,11 @@ public struct OGCScenarioBPost: Model { public var title: String public var owner: String? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, title: String, - owner: String? = nil) - { + owner: String? = nil + ) { self.id = id self.title = title self.owner = owner diff --git a/AmplifyTestCommon/Models/Post+Schema.swift b/AmplifyTestCommon/Models/Post+Schema.swift index 10639d312f..b79e38ead4 100644 --- a/AmplifyTestCommon/Models/Post+Schema.swift +++ b/AmplifyTestCommon/Models/Post+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case content diff --git a/AmplifyTestCommon/Models/Post.swift b/AmplifyTestCommon/Models/Post.swift index ea920cf24e..7c43a79452 100644 --- a/AmplifyTestCommon/Models/Post.swift +++ b/AmplifyTestCommon/Models/Post.swift @@ -20,7 +20,8 @@ public struct Post: Model { public var status: PostStatus? public var comments: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, title: String, content: String, createdAt: Temporal.DateTime, @@ -28,8 +29,8 @@ public struct Post: Model { draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, - comments: List? = []) - { + comments: List? = [] + ) { self.id = id self.title = title self.content = content diff --git a/AmplifyTestCommon/Models/QPredGen+Schema.swift b/AmplifyTestCommon/Models/QPredGen+Schema.swift index 5ec9920515..58ecadd569 100644 --- a/AmplifyTestCommon/Models/QPredGen+Schema.swift +++ b/AmplifyTestCommon/Models/QPredGen+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension QPredGen { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case myBool diff --git a/AmplifyTestCommon/Models/QPredGen.swift b/AmplifyTestCommon/Models/QPredGen.swift index c02f5c7deb..6c5f5e6406 100644 --- a/AmplifyTestCommon/Models/QPredGen.swift +++ b/AmplifyTestCommon/Models/QPredGen.swift @@ -35,7 +35,8 @@ public struct QPredGen: Model { public var myDateTime: Temporal.DateTime? public var myTime: Temporal.Time? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, name: String, myBool: Bool? = nil, myDouble: Double? = nil, @@ -43,8 +44,8 @@ public struct QPredGen: Model { myString: String? = nil, myDate: Temporal.Date? = nil, myDateTime: Temporal.DateTime? = nil, - myTime: Temporal.Time? = nil) - { + myTime: Temporal.Time? = nil + ) { self.id = id self.name = name self.myBool = myBool diff --git a/AmplifyTestCommon/Models/Record+Schema.swift b/AmplifyTestCommon/Models/Record+Schema.swift index ca3365f681..4f8fbd5ef9 100644 --- a/AmplifyTestCommon/Models/Record+Schema.swift +++ b/AmplifyTestCommon/Models/Record+Schema.swift @@ -12,8 +12,7 @@ import Foundation public extension Record { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case description @@ -33,20 +32,21 @@ public extension Record { model.listPluralName = "Records" model.fields( - .id(), - .field(record.name, is: .required, ofType: .string), - .field(record.description, is: .optional, ofType: .string), - .field(record.coverId, is: .optional, isReadOnly: true, ofType: .string), - .hasOne( - record.cover, - is: .optional, - isReadOnly: true, - ofType: RecordCover.self, - associatedWith: RecordCover.keys.id, - targetName: "coverId"), - .field(record.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), - .field(record.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) - ) + .id(), + .field(record.name, is: .required, ofType: .string), + .field(record.description, is: .optional, ofType: .string), + .field(record.coverId, is: .optional, isReadOnly: true, ofType: .string), + .hasOne( + record.cover, + is: .optional, + isReadOnly: true, + ofType: RecordCover.self, + associatedWith: RecordCover.keys.id, + targetName: "coverId" + ), + .field(record.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), + .field(record.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) + ) } } diff --git a/AmplifyTestCommon/Models/Record.swift b/AmplifyTestCommon/Models/Record.swift index b3214d1747..47608bb491 100644 --- a/AmplifyTestCommon/Models/Record.swift +++ b/AmplifyTestCommon/Models/Record.swift @@ -19,25 +19,29 @@ public struct Record: Model { public let createdAt: Temporal.DateTime? public let updatedAt: Temporal.DateTime? - public init(name: String, - description: String? = nil) - { - self.init(name: name, - description: description, - coverId: nil, - cover: nil, - createdAt: nil, - updatedAt: nil) + public init( + name: String, + description: String? = nil + ) { + self.init( + name: name, + description: description, + coverId: nil, + cover: nil, + createdAt: nil, + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - description: String? = nil, - coverId: String? = nil, - cover: RecordCover? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + description: String? = nil, + coverId: String? = nil, + cover: RecordCover? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.description = description diff --git a/AmplifyTestCommon/Models/RecordCover+Schema.swift b/AmplifyTestCommon/Models/RecordCover+Schema.swift index aba336a509..7b0fa29fcb 100644 --- a/AmplifyTestCommon/Models/RecordCover+Schema.swift +++ b/AmplifyTestCommon/Models/RecordCover+Schema.swift @@ -12,8 +12,7 @@ import Foundation public extension RecordCover { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case artist case createdAt @@ -30,10 +29,10 @@ public extension RecordCover { model.syncPluralName = "RecordCovers" model.fields( - .id(), - .field(recordCover.artist, is: .required, ofType: .string), - .field(recordCover.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), - .field(recordCover.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) - ) + .id(), + .field(recordCover.artist, is: .required, ofType: .string), + .field(recordCover.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), + .field(recordCover.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) + ) } } diff --git a/AmplifyTestCommon/Models/RecordCover.swift b/AmplifyTestCommon/Models/RecordCover.swift index 22ac2e0121..c3730c1d79 100644 --- a/AmplifyTestCommon/Models/RecordCover.swift +++ b/AmplifyTestCommon/Models/RecordCover.swift @@ -17,16 +17,19 @@ public struct RecordCover: Model { public let updatedAt: Temporal.DateTime? public init(artist: String) { - self.init(artist: artist, - createdAt: nil, - updatedAt: nil) + self.init( + artist: artist, + createdAt: nil, + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - artist: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + artist: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.artist = artist self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/ReservedWords/Row.swift b/AmplifyTestCommon/Models/ReservedWords/Row.swift index 738ae2860c..4db70b5d80 100644 --- a/AmplifyTestCommon/Models/ReservedWords/Row.swift +++ b/AmplifyTestCommon/Models/ReservedWords/Row.swift @@ -12,9 +12,10 @@ public struct Row: Model { public let id: String public var group: Group - public init(id: String = UUID().uuidString, - group: Group) - { + public init( + id: String = UUID().uuidString, + group: Group + ) { self.id = id self.group = group } diff --git a/AmplifyTestCommon/Models/Restaurant/Dish+Schema.swift b/AmplifyTestCommon/Models/Restaurant/Dish+Schema.swift index afe899a55a..e8945e7e10 100644 --- a/AmplifyTestCommon/Models/Restaurant/Dish+Schema.swift +++ b/AmplifyTestCommon/Models/Restaurant/Dish+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Dish { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case dishName case menu diff --git a/AmplifyTestCommon/Models/Restaurant/Dish.swift b/AmplifyTestCommon/Models/Restaurant/Dish.swift index b5d5667f7f..58afa9e691 100644 --- a/AmplifyTestCommon/Models/Restaurant/Dish.swift +++ b/AmplifyTestCommon/Models/Restaurant/Dish.swift @@ -14,10 +14,11 @@ public struct Dish: Model { public var dishName: String? public var menu: Menu? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, dishName: String? = nil, - menu: Menu? = nil) - { + menu: Menu? = nil + ) { self.id = id self.dishName = dishName self.menu = menu diff --git a/AmplifyTestCommon/Models/Restaurant/Menu+Schema.swift b/AmplifyTestCommon/Models/Restaurant/Menu+Schema.swift index 9888c51eb5..34a3e35ceb 100644 --- a/AmplifyTestCommon/Models/Restaurant/Menu+Schema.swift +++ b/AmplifyTestCommon/Models/Restaurant/Menu+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Menu { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case menuType diff --git a/AmplifyTestCommon/Models/Restaurant/Menu.swift b/AmplifyTestCommon/Models/Restaurant/Menu.swift index 564768a79b..7ec55a7ec6 100644 --- a/AmplifyTestCommon/Models/Restaurant/Menu.swift +++ b/AmplifyTestCommon/Models/Restaurant/Menu.swift @@ -16,12 +16,13 @@ public struct Menu: Model { public var restaurant: Restaurant? public var dishes: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, name: String, menuType: MenuType? = nil, restaurant: Restaurant? = nil, - dishes: List? = []) - { + dishes: List? = [] + ) { self.id = id self.name = name self.menuType = menuType diff --git a/AmplifyTestCommon/Models/Restaurant/Restaurant+Schema.swift b/AmplifyTestCommon/Models/Restaurant/Restaurant+Schema.swift index d1e7c68f7d..636f1d05ad 100644 --- a/AmplifyTestCommon/Models/Restaurant/Restaurant+Schema.swift +++ b/AmplifyTestCommon/Models/Restaurant/Restaurant+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Restaurant { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case restaurantName case menus diff --git a/AmplifyTestCommon/Models/Restaurant/Restaurant.swift b/AmplifyTestCommon/Models/Restaurant/Restaurant.swift index d8e7cbdfd5..20ec8bde27 100644 --- a/AmplifyTestCommon/Models/Restaurant/Restaurant.swift +++ b/AmplifyTestCommon/Models/Restaurant/Restaurant.swift @@ -14,10 +14,11 @@ public struct Restaurant: Model { public var restaurantName: String public var menus: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, restaurantName: String, - menus: List? = []) - { + menus: List? = [] + ) { self.id = id self.restaurantName = restaurantName self.menus = menus diff --git a/AmplifyTestCommon/Models/Scalar/EnumTestModel+Schema.swift b/AmplifyTestCommon/Models/Scalar/EnumTestModel+Schema.swift index b59675601f..bd9858f7d1 100644 --- a/AmplifyTestCommon/Models/Scalar/EnumTestModel+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/EnumTestModel+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension EnumTestModel { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case enumVal case nullableEnumVal diff --git a/AmplifyTestCommon/Models/Scalar/EnumTestModel.swift b/AmplifyTestCommon/Models/Scalar/EnumTestModel.swift index 6f6610f22b..ac3e7f73e3 100644 --- a/AmplifyTestCommon/Models/Scalar/EnumTestModel.swift +++ b/AmplifyTestCommon/Models/Scalar/EnumTestModel.swift @@ -18,14 +18,15 @@ public struct EnumTestModel: Model { public var nullableEnumList: [TestEnum?] public var nullableEnumNullableList: [TestEnum?]? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum] = [], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?] = [], - nullableEnumNullableList: [TestEnum?]? = nil) - { + nullableEnumNullableList: [TestEnum?]? = nil + ) { self.id = id self.enumVal = enumVal self.nullableEnumVal = nullableEnumVal diff --git a/AmplifyTestCommon/Models/Scalar/ListIntContainer+Schema.swift b/AmplifyTestCommon/Models/Scalar/ListIntContainer+Schema.swift index 00497b1fe4..8362ac98fe 100644 --- a/AmplifyTestCommon/Models/Scalar/ListIntContainer+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/ListIntContainer+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ListIntContainer { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case test case nullableInt diff --git a/AmplifyTestCommon/Models/Scalar/ListIntContainer.swift b/AmplifyTestCommon/Models/Scalar/ListIntContainer.swift index 019eba2286..45604058ba 100644 --- a/AmplifyTestCommon/Models/Scalar/ListIntContainer.swift +++ b/AmplifyTestCommon/Models/Scalar/ListIntContainer.swift @@ -18,14 +18,15 @@ public struct ListIntContainer: Model { public var nullableIntList: [Int?] public var nullableIntNullableList: [Int?]? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, test: Int, nullableInt: Int? = nil, intList: [Int] = [], intNullableList: [Int]? = nil, nullableIntList: [Int?] = [], - nullableIntNullableList: [Int?]? = nil) - { + nullableIntNullableList: [Int?]? = nil + ) { self.id = id self.test = test self.nullableInt = nullableInt diff --git a/AmplifyTestCommon/Models/Scalar/ListStringContainer+Schema.swift b/AmplifyTestCommon/Models/Scalar/ListStringContainer+Schema.swift index f9091501c8..28095c5617 100644 --- a/AmplifyTestCommon/Models/Scalar/ListStringContainer+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/ListStringContainer+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ListStringContainer { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case test case nullableString diff --git a/AmplifyTestCommon/Models/Scalar/ListStringContainer.swift b/AmplifyTestCommon/Models/Scalar/ListStringContainer.swift index d117df701c..712c970012 100644 --- a/AmplifyTestCommon/Models/Scalar/ListStringContainer.swift +++ b/AmplifyTestCommon/Models/Scalar/ListStringContainer.swift @@ -18,14 +18,15 @@ public struct ListStringContainer: Model { public var nullableStringList: [String?] public var nullableStringNullableList: [String?]? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, test: String, nullableString: String? = nil, stringList: [String] = [], stringNullableList: [String]? = nil, nullableStringList: [String?] = [], - nullableStringNullableList: [String?]? = nil) - { + nullableStringNullableList: [String?]? = nil + ) { self.id = id self.test = test self.nullableString = nullableString diff --git a/AmplifyTestCommon/Models/Scalar/Nested+Schema.swift b/AmplifyTestCommon/Models/Scalar/Nested+Schema.swift index a71f0c2385..edafe3cc62 100644 --- a/AmplifyTestCommon/Models/Scalar/Nested+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/Nested+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Nested { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case valueOne case valueTwo } diff --git a/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel+Schema.swift b/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel+Schema.swift index 17b73bd87e..806dce775f 100644 --- a/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension NestedTypeTestModel { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case nestedVal case nullableNestedVal diff --git a/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel.swift b/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel.swift index 31f881d908..c9ba508760 100644 --- a/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel.swift +++ b/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel.swift @@ -18,14 +18,15 @@ public struct NestedTypeTestModel: Model { public var nullableNestedList: [Nested?] public var nullableNestedNullableList: [Nested?]? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, nestedVal: Nested, nullableNestedVal: Nested? = nil, nestedList: [Nested] = [], nestedNullableList: [Nested]? = nil, nullableNestedList: [Nested?] = [], - nullableNestedNullableList: [Nested?]? = nil) - { + nullableNestedNullableList: [Nested?]? = nil + ) { self.id = id self.nestedVal = nestedVal self.nullableNestedVal = nullableNestedVal diff --git a/AmplifyTestCommon/Models/Scalar/ScalarContainer+Schema.swift b/AmplifyTestCommon/Models/Scalar/ScalarContainer+Schema.swift index b34958a38a..d05931be73 100644 --- a/AmplifyTestCommon/Models/Scalar/ScalarContainer+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/ScalarContainer+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ScalarContainer { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case myString case myInt diff --git a/AmplifyTestCommon/Models/Scalar/ScalarContainer.swift b/AmplifyTestCommon/Models/Scalar/ScalarContainer.swift index 9f36c04ad4..94b6ff7475 100644 --- a/AmplifyTestCommon/Models/Scalar/ScalarContainer.swift +++ b/AmplifyTestCommon/Models/Scalar/ScalarContainer.swift @@ -25,7 +25,8 @@ public struct ScalarContainer: Model { public var myURL: String? public var myIPAddress: String? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, @@ -38,8 +39,8 @@ public struct ScalarContainer: Model { myJSON: String? = nil, myPhone: String? = nil, myURL: String? = nil, - myIPAddress: String? = nil) - { + myIPAddress: String? = nil + ) { self.id = id self.myString = myString self.myInt = myInt diff --git a/AmplifyTestCommon/Models/ScenarioATest6Post+Schema.swift b/AmplifyTestCommon/Models/ScenarioATest6Post+Schema.swift index 06bb69473d..cbc6d7ea57 100644 --- a/AmplifyTestCommon/Models/ScenarioATest6Post+Schema.swift +++ b/AmplifyTestCommon/Models/ScenarioATest6Post+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension ScenarioATest6Post { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title } diff --git a/AmplifyTestCommon/Models/ScenarioATest6Post.swift b/AmplifyTestCommon/Models/ScenarioATest6Post.swift index 4840247b04..db203304ff 100644 --- a/AmplifyTestCommon/Models/ScenarioATest6Post.swift +++ b/AmplifyTestCommon/Models/ScenarioATest6Post.swift @@ -13,9 +13,10 @@ public struct ScenarioATest6Post: Model { public let id: String public var title: String - public init(id: String = UUID().uuidString, - title: String) - { + public init( + id: String = UUID().uuidString, + title: String + ) { self.id = id self.title = title } diff --git a/AmplifyTestCommon/Models/TeamProject/Project+Schema.swift b/AmplifyTestCommon/Models/TeamProject/Project+Schema.swift index 2f7f8b2ea2..1716d0b332 100644 --- a/AmplifyTestCommon/Models/TeamProject/Project+Schema.swift +++ b/AmplifyTestCommon/Models/TeamProject/Project+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Project { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case team diff --git a/AmplifyTestCommon/Models/TeamProject/Project.swift b/AmplifyTestCommon/Models/TeamProject/Project.swift index 4dc1c54b33..db3e85ced2 100644 --- a/AmplifyTestCommon/Models/TeamProject/Project.swift +++ b/AmplifyTestCommon/Models/TeamProject/Project.swift @@ -14,10 +14,11 @@ public struct Project: Model { public var name: String? public var team: Team? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, name: String? = nil, - team: Team? = nil) - { + team: Team? = nil + ) { self.id = id self.name = name self.team = team diff --git a/AmplifyTestCommon/Models/TeamProject/Team+Schema.swift b/AmplifyTestCommon/Models/TeamProject/Team+Schema.swift index db2beb6552..d6dbe43e23 100644 --- a/AmplifyTestCommon/Models/TeamProject/Team+Schema.swift +++ b/AmplifyTestCommon/Models/TeamProject/Team+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Team { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name } diff --git a/AmplifyTestCommon/Models/TeamProject/Team.swift b/AmplifyTestCommon/Models/TeamProject/Team.swift index 579456315f..086f20f10a 100644 --- a/AmplifyTestCommon/Models/TeamProject/Team.swift +++ b/AmplifyTestCommon/Models/TeamProject/Team.swift @@ -13,9 +13,10 @@ public struct Team: Model { public let id: String public var name: String - public init(id: String = UUID().uuidString, - name: String) - { + public init( + id: String = UUID().uuidString, + name: String + ) { self.id = id self.name = name } diff --git a/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2+Schema.swift index c176692ba9..f798199559 100644 --- a/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Project1V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case team diff --git a/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2.swift b/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2.swift index e2f55e90f3..7cf9f9a23f 100644 --- a/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2.swift @@ -17,25 +17,29 @@ public struct Project1V2: Model { public var updatedAt: Temporal.DateTime? public var project1V2TeamId: String? - public init(id: String = UUID().uuidString, - name: String? = nil, - team: Team1V2? = nil, - project1V2TeamId: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String? = nil, + team: Team1V2? = nil, + project1V2TeamId: String? = nil + ) { + self.init( + id: id, name: name, team: team, createdAt: nil, updatedAt: nil, - project1V2TeamId: project1V2TeamId) + project1V2TeamId: project1V2TeamId + ) } - init(id: String = UUID().uuidString, - name: String? = nil, - team: Team1V2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - project1V2TeamId: String? = nil) - { + init( + id: String = UUID().uuidString, + name: String? = nil, + team: Team1V2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + project1V2TeamId: String? = nil + ) { self.id = id self.name = name self.team = team diff --git a/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2+Schema.swift index d0e924104a..2fa869b077 100644 --- a/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Team1V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2.swift b/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2.swift index e27afbad48..9e547cc972 100644 --- a/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2.swift @@ -15,19 +15,23 @@ public struct Team1V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String + ) { + self.init( + id: id, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2+Schema.swift index 9b641521ac..b1d25f76ab 100644 --- a/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Project2V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case teamID diff --git a/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2.swift b/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2.swift index f0059db9ff..adc2cfc7fc 100644 --- a/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2.swift @@ -17,25 +17,29 @@ public struct Project2V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String? = nil, - teamID: String, - team: Team2V2? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String? = nil, + teamID: String, + team: Team2V2? = nil + ) { + self.init( + id: id, name: name, teamID: teamID, team: team, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String? = nil, - teamID: String, - team: Team2V2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String? = nil, + teamID: String, + team: Team2V2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.teamID = teamID diff --git a/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2+Schema.swift index 62a80a8c70..0db2c5e78b 100644 --- a/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Team2V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2.swift b/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2.swift index 27fa15fdcd..9b8e27a8b3 100644 --- a/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2.swift @@ -15,19 +15,23 @@ public struct Team2V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String + ) { + self.init( + id: id, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2+Schema.swift index 0147d09715..023f2e2d90 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment3V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case postID case content diff --git a/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2.swift b/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2.swift index a02d7daca4..6f0647dd70 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2.swift @@ -16,22 +16,26 @@ public struct Comment3V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - postID: String, - content: String) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + postID: String, + content: String + ) { + self.init( + id: id, postID: postID, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - postID: String, - content: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + postID: String, + content: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.postID = postID self.content = content diff --git a/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2+Schema.swift index d31861d141..e8525efd3a 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post3V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case comments diff --git a/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2.swift b/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2.swift index c19dff9143..bfd3f9db93 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2.swift @@ -16,22 +16,26 @@ public struct Post3V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments diff --git a/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2+Schema.swift index 0c5dec1f6d..a2efc3dd3f 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment3aV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2.swift b/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2.swift index 94e1e4c6f1..362732db79 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2.swift @@ -16,22 +16,26 @@ public struct Comment3aV2: Model { public var updatedAt: Temporal.DateTime? public var post3aV2CommentsId: String? - public init(id: String = UUID().uuidString, - content: String, - post3aV2CommentsId: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String, + post3aV2CommentsId: String? = nil + ) { + self.init( + id: id, content: content, createdAt: nil, updatedAt: nil, - post3aV2CommentsId: post3aV2CommentsId) + post3aV2CommentsId: post3aV2CommentsId + ) } - init(id: String = UUID().uuidString, - content: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - post3aV2CommentsId: String? = nil) - { + init( + id: String = UUID().uuidString, + content: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + post3aV2CommentsId: String? = nil + ) { self.id = id self.content = content self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2+Schema.swift index 6721f2b9ae..067713be06 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post3aV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case comments diff --git a/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2.swift b/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2.swift index 1a1fb9ba46..78361ec783 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2.swift @@ -16,22 +16,26 @@ public struct Post3aV2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments diff --git a/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2+Schema.swift index 3aa2fdfcf5..90683b5561 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment4V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case post diff --git a/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2.swift b/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2.swift index b8f5ffe8b3..0d4073d6b4 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2.swift @@ -16,22 +16,26 @@ public struct Comment4V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - content: String, - post: Post4V2? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String, + post: Post4V2? = nil + ) { + self.init( + id: id, content: content, post: post, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - content: String, - post: Post4V2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + content: String, + post: Post4V2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.post = post diff --git a/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2+Schema.swift index a57605845f..e010e1c080 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post4V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case comments diff --git a/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2.swift b/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2.swift index 2fa77c850a..9106744759 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2.swift @@ -16,22 +16,26 @@ public struct Post4V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments diff --git a/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2+Schema.swift index 16bd6f6c5f..63cb47ada7 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Project4aV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case team diff --git a/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2.swift b/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2.swift index addfb388c5..4777b1dcda 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2.swift @@ -21,25 +21,29 @@ public class Project4aV2: Model { public var updatedAt: Temporal.DateTime? public var project4aV2TeamId: String? - public convenience init(id: String = UUID().uuidString, + public convenience init( + id: String = UUID().uuidString, name: String? = nil, team: Team4aV2? = nil, - project4aV2TeamId: String? = nil) - { - self.init(id: id, + project4aV2TeamId: String? = nil + ) { + self.init( + id: id, name: name, team: team, createdAt: nil, updatedAt: nil, - project4aV2TeamId: project4aV2TeamId) + project4aV2TeamId: project4aV2TeamId + ) } - init(id: String = UUID().uuidString, - name: String? = nil, - team: Team4aV2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - project4aV2TeamId: String? = nil) - { + init( + id: String = UUID().uuidString, + name: String? = nil, + team: Team4aV2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + project4aV2TeamId: String? = nil + ) { self.id = id self.name = name self.team = team diff --git a/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2+Schema.swift index 885bad3b8c..18ccef180d 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Team4aV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case project diff --git a/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2.swift b/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2.swift index 02a95f6e57..7abfb7100b 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2.swift @@ -16,22 +16,26 @@ public class Team4aV2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public convenience init(id: String = UUID().uuidString, + public convenience init( + id: String = UUID().uuidString, name: String, - project: Project4aV2? = nil) - { - self.init(id: id, + project: Project4aV2? = nil + ) { + self.init( + id: id, name: name, project: project, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - project: Project4aV2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + project: Project4aV2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.project = project diff --git a/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2+Schema.swift index 19aa0120c8..e3f4983c80 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Project4bV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case team diff --git a/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2.swift b/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2.swift index d450fe8f49..9b280c61df 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2.swift @@ -17,25 +17,29 @@ public class Project4bV2: Model { public var updatedAt: Temporal.DateTime? public var project4bV2TeamId: String? - public convenience init(id: String = UUID().uuidString, + public convenience init( + id: String = UUID().uuidString, name: String? = nil, team: Team4bV2? = nil, - project4bV2TeamId: String? = nil) - { - self.init(id: id, + project4bV2TeamId: String? = nil + ) { + self.init( + id: id, name: name, team: team, createdAt: nil, updatedAt: nil, - project4bV2TeamId: project4bV2TeamId) + project4bV2TeamId: project4bV2TeamId + ) } - init(id: String = UUID().uuidString, - name: String? = nil, - team: Team4bV2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - project4bV2TeamId: String? = nil) - { + init( + id: String = UUID().uuidString, + name: String? = nil, + team: Team4bV2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + project4bV2TeamId: String? = nil + ) { self.id = id self.name = name self.team = team diff --git a/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2+Schema.swift index f4ba216f51..eb0ec1c290 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Team4bV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case project diff --git a/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2.swift b/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2.swift index 7e7e71ac63..b1831b611b 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2.swift @@ -16,22 +16,26 @@ public class Team4bV2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public convenience init(id: String = UUID().uuidString, + public convenience init( + id: String = UUID().uuidString, name: String, - project: Project4bV2? = nil) - { - self.init(id: id, + project: Project4bV2? = nil + ) { + self.init( + id: id, name: name, project: project, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - project: Project4bV2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + project: Project4bV2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.project = project diff --git a/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2+Schema.swift index 1b6544ed3b..9528d2576d 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post5V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case editors diff --git a/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2.swift b/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2.swift index bdcd0fedec..1090df258b 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2.swift @@ -16,22 +16,26 @@ public struct Post5V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - editors: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + editors: List? = [] + ) { + self.init( + id: id, title: title, editors: editors, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - editors: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + editors: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.editors = editors diff --git a/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2+Schema.swift index 5a0d9ded03..23a7be5848 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension PostEditor5V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case post5V2 case user5V2 diff --git a/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2.swift b/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2.swift index 765f90e5b2..dabb434aac 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2.swift @@ -16,22 +16,26 @@ public struct PostEditor5V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - post5V2: Post5V2, - user5V2: User5V2) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + post5V2: Post5V2, + user5V2: User5V2 + ) { + self.init( + id: id, post5V2: post5V2, user5V2: user5V2, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - post5V2: Post5V2, - user5V2: User5V2, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + post5V2: Post5V2, + user5V2: User5V2, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.post5V2 = post5V2 self.user5V2 = user5V2 diff --git a/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2+Schema.swift index fa1c0b4ce8..a15d33b3ab 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension User5V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case username case posts diff --git a/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2.swift b/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2.swift index edd9f0f46e..dbf049a0f0 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2.swift @@ -16,22 +16,26 @@ public struct User5V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - username: String, - posts: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + username: String, + posts: List? = [] + ) { + self.init( + id: id, username: username, posts: posts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - username: String, - posts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + username: String, + posts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.username = username self.posts = posts diff --git a/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2+Schema.swift index 3148e6d426..280cafde47 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Blog6V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case posts diff --git a/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2.swift b/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2.swift index 373b088c1d..b4cbf30247 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2.swift @@ -16,22 +16,26 @@ public struct Blog6V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String, - posts: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String, + posts: List? = [] + ) { + self.init( + id: id, name: name, posts: posts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - posts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + posts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.posts = posts diff --git a/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2+Schema.swift index 1e3e80dff5..cb476aa8cc 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment6V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case post case content diff --git a/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2.swift b/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2.swift index de69bee639..027da3fbc5 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2.swift @@ -16,22 +16,26 @@ public struct Comment6V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - post: Post6V2? = nil, - content: String) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + post: Post6V2? = nil, + content: String + ) { + self.init( + id: id, post: post, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - post: Post6V2? = nil, - content: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + post: Post6V2? = nil, + content: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.post = post self.content = content diff --git a/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2+Schema.swift index 880bda766c..8322b709e5 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post6V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case blog diff --git a/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2.swift b/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2.swift index 256914cf56..c955a6e87e 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2.swift @@ -17,25 +17,29 @@ public struct Post6V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - blog: Blog6V2? = nil, - comments: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + blog: Blog6V2? = nil, + comments: List? = [] + ) { + self.init( + id: id, title: title, blog: blog, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - blog: Blog6V2? = nil, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + blog: Blog6V2? = nil, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.blog = blog diff --git a/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2+Schema.swift index 83a88a0966..5e2f6f64ca 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Blog7V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case posts diff --git a/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2.swift b/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2.swift index b05ee7a517..537cd210a4 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2.swift @@ -16,22 +16,26 @@ public struct Blog7V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String, - posts: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String, + posts: List? = [] + ) { + self.init( + id: id, name: name, posts: posts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - posts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + posts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.posts = posts diff --git a/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2+Schema.swift index a18e97f569..077286678f 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment7V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case post diff --git a/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2.swift b/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2.swift index abf10ebea1..fa9b8c14ec 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2.swift @@ -16,22 +16,26 @@ public struct Comment7V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - content: String? = nil, - post: Post7V2? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String? = nil, + post: Post7V2? = nil + ) { + self.init( + id: id, content: content, post: post, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - content: String? = nil, - post: Post7V2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + content: String? = nil, + post: Post7V2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.post = post diff --git a/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2+Schema.swift index aa64967940..18d5da8dc9 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post7V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case blog diff --git a/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2.swift b/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2.swift index 9f67e96ad8..e6fe9a9aab 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2.swift @@ -17,25 +17,29 @@ public struct Post7V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - blog: Blog7V2? = nil, - comments: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + blog: Blog7V2? = nil, + comments: List? = [] + ) { + self.init( + id: id, title: title, blog: blog, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - blog: Blog7V2? = nil, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + blog: Blog7V2? = nil, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.blog = blog diff --git a/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2+Schema.swift index e5a0c0ee24..aa10f9edd5 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Attendee8V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case meetings case createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2.swift b/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2.swift index 7ab964caec..1ae9221f59 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2.swift @@ -15,19 +15,23 @@ public struct Attendee8V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - meetings: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + meetings: List? = [] + ) { + self.init( + id: id, meetings: meetings, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - meetings: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + meetings: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.meetings = meetings self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2+Schema.swift index 046b049a38..540f9e81b7 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Meeting8V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case attendees diff --git a/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2.swift b/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2.swift index bfe69260d9..8101985510 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2.swift @@ -16,22 +16,26 @@ public struct Meeting8V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - attendees: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + title: String, + attendees: List? = [] + ) { + self.init( + id: id, title: title, attendees: attendees, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - attendees: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + attendees: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.attendees = attendees diff --git a/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2+Schema.swift index 9dbcdd4946..303c84d91b 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Registration8V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case meeting case attendee diff --git a/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2.swift b/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2.swift index 90b2fc5000..3c572b4969 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2.swift @@ -16,22 +16,26 @@ public struct Registration8V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - meeting: Meeting8V2, - attendee: Attendee8V2) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + meeting: Meeting8V2, + attendee: Attendee8V2 + ) { + self.init( + id: id, meeting: meeting, attendee: attendee, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - meeting: Meeting8V2, - attendee: Attendee8V2, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + meeting: Meeting8V2, + attendee: Attendee8V2, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.meeting = meeting self.attendee = attendee diff --git a/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2+Schema.swift index 85a7f33720..fae219e308 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension CustomerMultipleSecondaryIndexV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case phoneNumber diff --git a/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2.swift b/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2.swift index 03ac7eb5a1..1c4e60e2d5 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2.swift @@ -18,28 +18,32 @@ public struct CustomerMultipleSecondaryIndexV2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String, - phoneNumber: String? = nil, - age: Int, - accountRepresentativeID: String) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String, + phoneNumber: String? = nil, + age: Int, + accountRepresentativeID: String + ) { + self.init( + id: id, name: name, phoneNumber: phoneNumber, age: age, accountRepresentativeID: accountRepresentativeID, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - phoneNumber: String? = nil, - age: Int, - accountRepresentativeID: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + phoneNumber: String? = nil, + age: Int, + accountRepresentativeID: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.phoneNumber = phoneNumber diff --git a/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2+Schema.swift index 242ec40537..1118ef8ca6 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension CustomerSecondaryIndexV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case phoneNumber diff --git a/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2.swift b/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2.swift index 4559a9ebd9..195405ac60 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2.swift @@ -17,25 +17,29 @@ public struct CustomerSecondaryIndexV2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String, - phoneNumber: String? = nil, - accountRepresentativeID: String) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String, + phoneNumber: String? = nil, + accountRepresentativeID: String + ) { + self.init( + id: id, name: name, phoneNumber: phoneNumber, accountRepresentativeID: accountRepresentativeID, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - phoneNumber: String? = nil, - accountRepresentativeID: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + phoneNumber: String? = nil, + accountRepresentativeID: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.phoneNumber = phoneNumber diff --git a/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK+Schema.swift index 9c9ea1472e..021d8bfa84 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension CustomerWithMultipleFieldsinPK { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case dob case date diff --git a/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK.swift b/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK.swift index b39698705c..0ae721e741 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK.swift @@ -22,17 +22,19 @@ public struct CustomerWithMultipleFieldsinPK: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - date: Temporal.Date, - time: Temporal.Time, - phoneNumber: Int, - priority: Priority, - height: Double, - firstName: String? = nil, - lastName: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + date: Temporal.Date, + time: Temporal.Time, + phoneNumber: Int, + priority: Priority, + height: Double, + firstName: String? = nil, + lastName: String? = nil + ) { + self.init( + id: id, dob: dob, date: date, time: time, @@ -42,20 +44,22 @@ public struct CustomerWithMultipleFieldsinPK: Model { firstName: firstName, lastName: lastName, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - dob: Temporal.DateTime, - date: Temporal.Date, - time: Temporal.Time, - phoneNumber: Int, - priority: Priority, - height: Double, - firstName: String? = nil, - lastName: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + dob: Temporal.DateTime, + date: Temporal.Date, + time: Temporal.Time, + phoneNumber: Int, + priority: Priority, + height: Double, + firstName: String? = nil, + lastName: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.dob = dob self.date = date diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8+Schema.swift index 3b3ee37886..9f21d12e70 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Blog8 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case customs diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8.swift index 5cd5a006ef..48aa59e7fc 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8.swift @@ -18,28 +18,32 @@ public struct Blog8: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String, - customs: [MyCustomModel8?]? = nil, - notes: [String?]? = nil, - posts: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String, + customs: [MyCustomModel8?]? = nil, + notes: [String?]? = nil, + posts: List? = [] + ) { + self.init( + id: id, name: name, customs: customs, notes: notes, posts: posts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - customs: [MyCustomModel8?]? = nil, - notes: [String?]? = nil, - posts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + customs: [MyCustomModel8?]? = nil, + notes: [String?]? = nil, + posts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.customs = customs diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8+Schema.swift index 2ed6d20988..f2e773e8ee 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Comment8 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case post diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8.swift index cb271b760d..d6fa843ba3 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8.swift @@ -16,22 +16,26 @@ public struct Comment8: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - content: String? = nil, - post: Post8? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String? = nil, + post: Post8? = nil + ) { + self.init( + id: id, content: content, post: post, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - content: String? = nil, - post: Post8? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + content: String? = nil, + post: Post8? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.post = post diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyCustomModel8+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyCustomModel8+Schema.swift index 22fd73073d..85693fb8fa 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyCustomModel8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyCustomModel8+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension MyCustomModel8 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case desc diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyNestedModel8+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyNestedModel8+Schema.swift index ecc52ed477..206fee3987 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyNestedModel8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyNestedModel8+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension MyNestedModel8 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case nestedName case notes diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8+Schema.swift index 81d5941efa..5cf1fb9e29 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension Post8 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case randomId diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8.swift index 051588fcd2..09bec3b160 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8.swift @@ -18,28 +18,32 @@ public struct Post8: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - name: String, - randomId: String? = nil, - blog: Blog8? = nil, - comments: List? = []) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + name: String, + randomId: String? = nil, + blog: Blog8? = nil, + comments: List? = [] + ) { + self.init( + id: id, name: name, randomId: randomId, blog: blog, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - name: String, - randomId: String? = nil, - blog: Blog8? = nil, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + name: String, + randomId: String? = nil, + blog: Blog8? = nil, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.randomId = randomId diff --git a/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift+Schema.swift index 5327762f2b..59af4deb74 100644 --- a/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension SchemaDrift { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case enumValue case createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift.swift b/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift.swift index af60370ec6..b6159e7589 100644 --- a/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift.swift +++ b/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift.swift @@ -30,19 +30,23 @@ public struct SchemaDrift: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - enumValue: EnumDrift? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + enumValue: EnumDrift? = nil + ) { + self.init( + id: id, enumValue: enumValue, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - enumValue: EnumDrift? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + enumValue: EnumDrift? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.enumValue = enumValue self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2+Schema.swift index 5023d196b6..2ed40a52b9 100644 --- a/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension TodoCustomTimestampV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case createdOn diff --git a/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2.swift b/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2.swift index ae64563c1b..97842a31a0 100644 --- a/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2.swift @@ -15,19 +15,23 @@ public struct TodoCustomTimestampV2: Model { public var createdOn: Temporal.DateTime? public var updatedOn: Temporal.DateTime? - public init(id: String = UUID().uuidString, - content: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String? = nil + ) { + self.init( + id: id, content: content, createdOn: nil, - updatedOn: nil) + updatedOn: nil + ) } - init(id: String = UUID().uuidString, - content: String? = nil, - createdOn: Temporal.DateTime? = nil, - updatedOn: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + content: String? = nil, + createdOn: Temporal.DateTime? = nil, + updatedOn: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.createdOn = createdOn diff --git a/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2+Schema.swift index e60bd05c2c..0e390adf51 100644 --- a/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension TodoWithDefaultValueV2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case createdAt diff --git a/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2.swift b/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2.swift index 363c553046..75c66e59c2 100644 --- a/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2.swift @@ -15,19 +15,23 @@ public struct TodoWithDefaultValueV2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - content: String? = nil) - { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String? = nil + ) { + self.init( + id: id, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - content: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + content: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/User+Schema.swift b/AmplifyTestCommon/Models/User+Schema.swift index 3676cc0d31..21093edf18 100644 --- a/AmplifyTestCommon/Models/User+Schema.swift +++ b/AmplifyTestCommon/Models/User+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension User { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case name case following diff --git a/AmplifyTestCommon/Models/User.swift b/AmplifyTestCommon/Models/User.swift index d34069fcb8..cd852353ea 100644 --- a/AmplifyTestCommon/Models/User.swift +++ b/AmplifyTestCommon/Models/User.swift @@ -15,11 +15,12 @@ public struct User: Model { public var following: List? public var followers: List? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, name: String, following: List? = [], - followers: List? = []) - { + followers: List? = [] + ) { self.id = id self.name = name self.following = following diff --git a/AmplifyTestCommon/Models/UserFollowers+Schema.swift b/AmplifyTestCommon/Models/UserFollowers+Schema.swift index 03f2999394..201dec549e 100644 --- a/AmplifyTestCommon/Models/UserFollowers+Schema.swift +++ b/AmplifyTestCommon/Models/UserFollowers+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension UserFollowers { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case user case followersUser diff --git a/AmplifyTestCommon/Models/UserFollowers.swift b/AmplifyTestCommon/Models/UserFollowers.swift index 03cae97240..ccbc4f0e10 100644 --- a/AmplifyTestCommon/Models/UserFollowers.swift +++ b/AmplifyTestCommon/Models/UserFollowers.swift @@ -14,10 +14,11 @@ public struct UserFollowers: Model { public var user: User? public var followersUser: User? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, user: User? = nil, - followersUser: User? = nil) - { + followersUser: User? = nil + ) { self.id = id self.user = user self.followersUser = followersUser diff --git a/AmplifyTestCommon/Models/UserFollowing+Schema.swift b/AmplifyTestCommon/Models/UserFollowing+Schema.swift index 37d9ac8151..0f848b9089 100644 --- a/AmplifyTestCommon/Models/UserFollowing+Schema.swift +++ b/AmplifyTestCommon/Models/UserFollowing+Schema.swift @@ -11,8 +11,7 @@ import Foundation public extension UserFollowing { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case user case followingUser diff --git a/AmplifyTestCommon/Models/UserFollowing.swift b/AmplifyTestCommon/Models/UserFollowing.swift index 73d450926b..cc61a04a54 100644 --- a/AmplifyTestCommon/Models/UserFollowing.swift +++ b/AmplifyTestCommon/Models/UserFollowing.swift @@ -14,10 +14,11 @@ public struct UserFollowing: Model { public var user: User? public var followingUser: User? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, user: User? = nil, - followingUser: User? = nil) - { + followingUser: User? = nil + ) { self.id = id self.user = user self.followingUser = followingUser diff --git a/AmplifyTestCommon/SharedTestCases/SharedTestCasesPostComment4V2.swift b/AmplifyTestCommon/SharedTestCases/SharedTestCasesPostComment4V2.swift index 5b7eebd08d..ce671d3d38 100644 --- a/AmplifyTestCommon/SharedTestCases/SharedTestCasesPostComment4V2.swift +++ b/AmplifyTestCommon/SharedTestCases/SharedTestCasesPostComment4V2.swift @@ -51,22 +51,26 @@ public struct LazyParentPost4V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) - { - self.init(id: id, - title: title, - comments: comments, - createdAt: nil, - updatedAt: nil) + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, + title: title, + comments: comments, + createdAt: nil, + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments @@ -118,22 +122,26 @@ public struct LazyChildComment4V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - content: String, - post: LazyParentPost4V2? = nil) - { - self.init(id: id, - content: content, - post: post, - createdAt: nil, - updatedAt: nil) + public init( + id: String = UUID().uuidString, + content: String, + post: LazyParentPost4V2? = nil + ) { + self.init( + id: id, + content: content, + post: post, + createdAt: nil, + updatedAt: nil + ) } - init(id: String = UUID().uuidString, - content: String, - post: LazyParentPost4V2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + init( + id: String = UUID().uuidString, + content: String, + post: LazyParentPost4V2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self._post = LazyReference(post) @@ -209,22 +217,26 @@ public struct ParentPost4V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, title: String, - comments: List? = []) - { - self.init(id: id, - title: title, - comments: comments, - createdAt: nil, - updatedAt: nil) + comments: List? = [] + ) { + self.init( + id: id, + title: title, + comments: comments, + createdAt: nil, + updatedAt: nil + ) } - init(id: String = UUID().uuidString, + init( + id: String = UUID().uuidString, title: String, comments: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments @@ -234,8 +246,7 @@ public struct ParentPost4V2: Model { } public extension ParentPost4V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case title case comments @@ -250,17 +261,17 @@ public extension ParentPost4V2 { let post4V2 = Post4V2.keys model.authRules = [ - rule(allow: .public, operations: [.create, .update, .delete, .read]) + rule(allow: .public, operations: [.create, .update, .delete, .read]) ] model.pluralName = "ParentPost4V2s" model.fields( - .id(), - .field(post4V2.title, is: .required, ofType: .string), - .hasMany(post4V2.comments, is: .optional, ofType: ChildComment4V2.self, associatedWith: ChildComment4V2.keys.post), - .field(post4V2.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), - .field(post4V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) + .id(), + .field(post4V2.title, is: .required, ofType: .string), + .hasMany(post4V2.comments, is: .optional, ofType: ChildComment4V2.self, associatedWith: ChildComment4V2.keys.post), + .field(post4V2.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), + .field(post4V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } } @@ -272,22 +283,26 @@ public struct ChildComment4V2: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, + public init( + id: String = UUID().uuidString, content: String, - post: ParentPost4V2? = nil) - { - self.init(id: id, - content: content, - post: post, - createdAt: nil, - updatedAt: nil) + post: ParentPost4V2? = nil + ) { + self.init( + id: id, + content: content, + post: post, + createdAt: nil, + updatedAt: nil + ) } - init(id: String = UUID().uuidString, + init( + id: String = UUID().uuidString, content: String, post: ParentPost4V2? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) - { + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.post = post @@ -298,8 +313,7 @@ public struct ChildComment4V2: Model { public extension ChildComment4V2 { // MARK: - CodingKeys - enum CodingKeys: String, ModelKey - { + enum CodingKeys: String, ModelKey { case id case content case post @@ -314,7 +328,7 @@ public extension ChildComment4V2 { let comment4V2 = Comment4V2.keys model.authRules = [ - rule(allow: .public, operations: [.create, .update, .delete, .read]) + rule(allow: .public, operations: [.create, .update, .delete, .read]) ] model.pluralName = "ChildComment4V2s" @@ -324,11 +338,11 @@ public extension ChildComment4V2 { ) model.fields( - .id(), - .field(comment4V2.content, is: .required, ofType: .string), - .belongsTo(comment4V2.post, is: .optional, ofType: ParentPost4V2.self, targetName: "postID"), - .field(comment4V2.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), - .field(comment4V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) + .id(), + .field(comment4V2.content, is: .required, ofType: .string), + .belongsTo(comment4V2.post, is: .optional, ofType: ParentPost4V2.self, targetName: "postID"), + .field(comment4V2.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime), + .field(comment4V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } } diff --git a/AmplifyTests/CategoryTests/API/APICategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/API/APICategoryConfigurationTests.swift index 09dd5074dc..3b40b0bbc8 100644 --- a/AmplifyTests/CategoryTests/API/APICategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/API/APICategoryConfigurationTests.swift @@ -99,9 +99,10 @@ class APICategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) await Amplify.reset() - XCTAssertThrowsError(try Amplify.API.getPlugin(for: "MockAPICategoryPlugin"), - "Getting a plugin after reset() should throw") - { error in + XCTAssertThrowsError( + try Amplify.API.getPlugin(for: "MockAPICategoryPlugin"), + "Getting a plugin after reset() should throw" + ) { error in guard case APIError.invalidConfiguration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -287,9 +288,10 @@ class APICategoryConfigurationTests: XCTestCase { try Amplify.API.configure(using: categoryConfig) - XCTAssertThrowsError(try Amplify.API.configure(using: categoryConfig), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.API.configure(using: categoryConfig), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -397,9 +399,10 @@ class APICategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) - XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.add(plugin: plugin), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return diff --git a/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryConfigurationTests.swift index a32dc464ab..95d1f07ade 100644 --- a/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryConfigurationTests.swift @@ -98,9 +98,10 @@ class AnalyticsCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) await Amplify.reset() - XCTAssertThrowsError(try Amplify.Analytics.getPlugin(for: "MockAnalyticsCategoryPlugin"), - "Getting a plugin after reset() should throw") - { error in + XCTAssertThrowsError( + try Amplify.Analytics.getPlugin(for: "MockAnalyticsCategoryPlugin"), + "Getting a plugin after reset() should throw" + ) { error in guard case AnalyticsError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -261,9 +262,10 @@ class AnalyticsCategoryConfigurationTests: XCTestCase { ) try Amplify.Analytics.configure(using: categoryConfig) - XCTAssertThrowsError(try Amplify.Analytics.configure(using: categoryConfig), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.Analytics.configure(using: categoryConfig), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -339,9 +341,10 @@ class AnalyticsCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) - XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.add(plugin: plugin), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return diff --git a/AmplifyTests/CategoryTests/Auth/AuthCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Auth/AuthCategoryConfigurationTests.swift index 735f96733b..8312114193 100644 --- a/AmplifyTests/CategoryTests/Auth/AuthCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Auth/AuthCategoryConfigurationTests.swift @@ -121,9 +121,10 @@ class AuthCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) await Amplify.reset() - XCTAssertThrowsError(try Amplify.Auth.getPlugin(for: "MockAuthCategoryPlugin"), - "Getting a plugin after reset() should throw") - { error in + XCTAssertThrowsError( + try Amplify.Auth.getPlugin(for: "MockAuthCategoryPlugin"), + "Getting a plugin after reset() should throw" + ) { error in guard case AuthError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -337,9 +338,10 @@ class AuthCategoryConfigurationTests: XCTestCase { ) XCTAssertNoThrow(try Amplify.Auth.configure(using: config)) - XCTAssertThrowsError(try Amplify.Auth.configure(using: config), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.Auth.configure(using: config), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -447,9 +449,10 @@ class AuthCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) - XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.add(plugin: plugin), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return diff --git a/AmplifyTests/CategoryTests/DataStore/DataStoreCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/DataStore/DataStoreCategoryConfigurationTests.swift index db970275df..7131b777f6 100644 --- a/AmplifyTests/CategoryTests/DataStore/DataStoreCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/DataStoreCategoryConfigurationTests.swift @@ -105,9 +105,10 @@ class DataStoreCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) await Amplify.reset() - XCTAssertThrowsError(try Amplify.DataStore.getPlugin(for: "MockDataStoreCategoryPlugin"), - "Getting a plugin after reset() should throw") - { error in + XCTAssertThrowsError( + try Amplify.DataStore.getPlugin(for: "MockDataStoreCategoryPlugin"), + "Getting a plugin after reset() should throw" + ) { error in guard case DataStoreError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -295,9 +296,10 @@ class DataStoreCategoryConfigurationTests: XCTestCase { ) try Amplify.DataStore.configure(using: categoryConfig) - XCTAssertThrowsError(try Amplify.DataStore.configure(using: categoryConfig), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.DataStore.configure(using: categoryConfig), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -373,9 +375,10 @@ class DataStoreCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) - XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.add(plugin: plugin), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return diff --git a/AmplifyTests/CategoryTests/DataStore/JSONValueHolderTest.swift b/AmplifyTests/CategoryTests/DataStore/JSONValueHolderTest.swift index fb370aa63c..46376e9537 100644 --- a/AmplifyTests/CategoryTests/DataStore/JSONValueHolderTest.swift +++ b/AmplifyTests/CategoryTests/DataStore/JSONValueHolderTest.swift @@ -10,9 +10,11 @@ import XCTest class JSONValueHolderTest: XCTestCase { - var jsonValueHodler = DynamicModel(values: ["id": 123, - "name": nil, - "comment": "here is a comment"]) + var jsonValueHodler = DynamicModel(values: [ + "id": 123, + "name": nil, + "comment": "here is a comment" + ]) func testJsonDoubleValue() { guard let id = jsonValueHodler.jsonValue(for: "id") as? Double else { @@ -66,8 +68,7 @@ struct DynamicModel: JSONValueHolder { public func jsonValue(for key: String, modelSchema: ModelSchema) -> Any?? { let field = modelSchema.field(withName: key) if case .int = field?.type, - case .some(.number(let deserializedValue)) = values[key] - { + case .some(.number(let deserializedValue)) = values[key] { return Int(deserializedValue) } return jsonValue(for: key) diff --git a/AmplifyTests/CategoryTests/DataStore/Model/ListTests.swift b/AmplifyTests/CategoryTests/DataStore/Model/ListTests.swift index 495caf26eb..961aa02d9c 100644 --- a/AmplifyTests/CategoryTests/DataStore/Model/ListTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/Model/ListTests.swift @@ -44,13 +44,14 @@ class ListTests: XCTestCase { var nextPage: List? var state: ModelListProviderState? - public init(elements: [Element] = [Element](), - error: CoreError? = nil, - errorOnLoad: CoreError? = nil, - errorOnNextPage: CoreError? = nil, - nextPage: List? = nil, - state: ModelListProviderState? = nil) - { + public init( + elements: [Element] = [Element](), + error: CoreError? = nil, + errorOnLoad: CoreError? = nil, + errorOnNextPage: CoreError? = nil, + nextPage: List? = nil, + state: ModelListProviderState? = nil + ) { self.elements = elements self.error = error self.errorOnLoad = errorOnLoad diff --git a/AmplifyTests/CategoryTests/DataStore/ModelFieldAssociationTests.swift b/AmplifyTests/CategoryTests/DataStore/ModelFieldAssociationTests.swift index fab9543e07..00845a7a6a 100644 --- a/AmplifyTests/CategoryTests/DataStore/ModelFieldAssociationTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/ModelFieldAssociationTests.swift @@ -80,9 +80,11 @@ class ModelFieldAssociationTests: XCTestCase { func testModelFieldWithBelongsToAssociation() { let belongsTo = ModelAssociation.belongsTo(associatedWith: nil, targetNames: ["commentPostId"]) - let field = ModelField.init(name: "post", - type: .model(type: Post.self), - association: belongsTo) + let field = ModelField.init( + name: "post", + type: .model(type: Post.self), + association: belongsTo + ) XCTAssertEqual("Post", field.associatedModelName) XCTAssertTrue(field.hasAssociation) @@ -91,10 +93,12 @@ class ModelFieldAssociationTests: XCTestCase { func testModelFieldWithHasManyAssociation() { let hasMany = ModelAssociation.hasMany(associatedWith: Comment.keys.post) - let field = ModelField.init(name: "comments", - type: .collection(of: Comment.self), - isArray: true, - association: hasMany) + let field = ModelField.init( + name: "comments", + type: .collection(of: Comment.self), + isArray: true, + association: hasMany + ) XCTAssertEqual("Comment", field.associatedModelName) XCTAssertTrue(field.hasAssociation) @@ -104,9 +108,11 @@ class ModelFieldAssociationTests: XCTestCase { func testModelFieldWithHasOneAssociation() { let hasOne = ModelAssociation.hasOne(associatedWith: Comment.keys.post, targetNames: ["postID"]) - let field = ModelField.init(name: "comment", - type: .model(type: Comment.self), - association: hasOne) + let field = ModelField.init( + name: "comment", + type: .model(type: Comment.self), + association: hasOne + ) XCTAssertEqual("Comment", field.associatedModelName) XCTAssertTrue(field.hasAssociation) diff --git a/AmplifyTests/CategoryTests/DataStore/ModelIdentifierTests.swift b/AmplifyTests/CategoryTests/DataStore/ModelIdentifierTests.swift index 56fddc6429..4689aae23d 100644 --- a/AmplifyTests/CategoryTests/DataStore/ModelIdentifierTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/ModelIdentifierTests.swift @@ -106,9 +106,11 @@ class ModelIdentifierTests: XCTestCase { } func testModelIdentifierCompositePredicate() { - let model = ModelCompositePk(id: "id", - dob: Temporal.DateTime.now(), - name: "name") + let model = ModelCompositePk( + id: "id", + dob: Temporal.DateTime.now(), + name: "name" + ) let identifier = model.identifier(schema: ModelCompositePk.schema) diff --git a/AmplifyTests/CategoryTests/DataStore/TemporalTests.swift b/AmplifyTests/CategoryTests/DataStore/TemporalTests.swift index 914cd6ee24..e18d519486 100644 --- a/AmplifyTests/CategoryTests/DataStore/TemporalTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/TemporalTests.swift @@ -35,7 +35,8 @@ class TemporalTests: XCTestCase { XCTAssertEqual(datetime.iso8601FormattedString(format: .long, timeZone: .utc), "2020-01-20T08:00:00Z") XCTAssertEqual( datetime.iso8601FormattedString(format: .full, timeZone: pst), - "2020-01-20T00:00:00.000-08:00") + "2020-01-20T00:00:00.000-08:00" + ) XCTAssertEqual(datetime.iso8601FormattedString(format: .full, timeZone: .utc), "2020-01-20T08:00:00.000Z") } catch { XCTFail(error.localizedDescription) @@ -105,7 +106,8 @@ class TemporalTests: XCTestCase { XCTAssertEqual(datetime.iso8601FormattedString(format: .long, timeZone: .utc), "2020-01-20T08:00:00Z") XCTAssertEqual( datetime.iso8601FormattedString(format: .full, timeZone: pst), - "2020-01-20T00:00:00.000-08:00") + "2020-01-20T00:00:00.000-08:00" + ) XCTAssertEqual(datetime.iso8601FormattedString(format: .full, timeZone: .utc), "2020-01-20T08:00:00.000Z") } catch { XCTFail(error.localizedDescription) @@ -125,28 +127,36 @@ class TemporalTests: XCTestCase { XCTAssertEqual(datetime.iso8601String, "2020-01-20T08:00:00.000Z") XCTAssertEqual( datetime.iso8601FormattedString(format: .short, timeZone: pst), - "2020-01-20T00:00") + "2020-01-20T00:00" + ) XCTAssertEqual( datetime.iso8601FormattedString(format: .short, timeZone: .utc), - "2020-01-20T08:00") + "2020-01-20T08:00" + ) XCTAssertEqual( datetime.iso8601FormattedString(format: .medium, timeZone: pst), - "2020-01-20T00:00:00") + "2020-01-20T00:00:00" + ) XCTAssertEqual( datetime.iso8601FormattedString(format: .medium, timeZone: .utc), - "2020-01-20T08:00:00") + "2020-01-20T08:00:00" + ) XCTAssertEqual( datetime.iso8601FormattedString(format: .long, timeZone: pst), - "2020-01-20T00:00:00-08:00") + "2020-01-20T00:00:00-08:00" + ) XCTAssertEqual( datetime.iso8601FormattedString(format: .long, timeZone: .utc), - "2020-01-20T08:00:00Z") + "2020-01-20T08:00:00Z" + ) XCTAssertEqual( datetime.iso8601FormattedString(format: .full, timeZone: pst), - "2020-01-20T00:00:00.000-08:00") + "2020-01-20T00:00:00.000-08:00" + ) XCTAssertEqual( datetime.iso8601FormattedString(format: .full, timeZone: .utc), - "2020-01-20T08:00:00.000Z") + "2020-01-20T08:00:00.000Z" + ) } catch { XCTFail(error.localizedDescription) } @@ -171,7 +181,8 @@ class TemporalTests: XCTestCase { XCTAssertEqual(datetime.iso8601FormattedString(format: .long, timeZone: .utc), "2020-01-20T08:00:00Z") XCTAssertEqual( datetime.iso8601FormattedString(format: .full, timeZone: pst), - "2020-01-20T00:00:00.180-08:00") + "2020-01-20T00:00:00.180-08:00" + ) XCTAssertEqual(datetime.iso8601FormattedString(format: .full, timeZone: .utc), "2020-01-20T08:00:00.180Z") } catch { XCTFail(error.localizedDescription) @@ -197,7 +208,8 @@ class TemporalTests: XCTestCase { XCTAssertEqual(datetime.iso8601FormattedString(format: .long, timeZone: .utc), "2020-01-20T16:00:00Z") XCTAssertEqual( datetime.iso8601FormattedString(format: .full, timeZone: pst), - "2020-01-20T08:00:00.180-08:00") + "2020-01-20T08:00:00.180-08:00" + ) XCTAssertEqual(datetime.iso8601FormattedString(format: .full, timeZone: .utc), "2020-01-20T16:00:00.180Z") } catch { XCTFail(error.localizedDescription) diff --git a/AmplifyTests/CategoryTests/Geo/GeoCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Geo/GeoCategoryConfigurationTests.swift index f13b3b181e..ad40da96dd 100644 --- a/AmplifyTests/CategoryTests/Geo/GeoCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Geo/GeoCategoryConfigurationTests.swift @@ -80,9 +80,10 @@ class GeoCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) await Amplify.reset() - XCTAssertThrowsError(try Amplify.Geo.getPlugin(for: "MockGeoCategoryPlugin"), - "Getting a plugin after reset() should throw") - { error in + XCTAssertThrowsError( + try Amplify.Geo.getPlugin(for: "MockGeoCategoryPlugin"), + "Getting a plugin after reset() should throw" + ) { error in guard case Geo.Error.invalidConfiguration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -240,9 +241,10 @@ class GeoCategoryConfigurationTests: XCTestCase { ) try Amplify.Geo.configure(using: categoryConfig) - XCTAssertThrowsError(try Amplify.Geo.configure(using: categoryConfig), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.Geo.configure(using: categoryConfig), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -318,9 +320,10 @@ class GeoCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) - XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.add(plugin: plugin), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return diff --git a/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift b/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift index 12e080eb1e..4af4f96b8d 100644 --- a/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift +++ b/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift @@ -119,104 +119,125 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { func configure(using configuration: Any?) throws {} - func getURL(key: String, - options: StorageGetURLRequest.Options? = nil, - resultListener: StorageGetURLOperation.ResultListener? = nil) -> StorageGetURLOperation - { + func getURL( + key: String, + options: StorageGetURLRequest.Options? = nil, + resultListener: StorageGetURLOperation.ResultListener? = nil + ) -> StorageGetURLOperation { let options = options ?? StorageGetURLRequest.Options() let request = StorageGetURLRequest(key: key, options: options) - let operation = MockDispatchingStorageGetURLOperation(request: request, - resultListener: resultListener) + let operation = MockDispatchingStorageGetURLOperation( + request: request, + resultListener: resultListener + ) return operation } - func downloadData(key: String, - options: StorageDownloadDataRequest.Options? = nil, - progressListener: ProgressListener? = nil, - resultListener: StorageDownloadDataOperation.ResultListener? = nil + func downloadData( + key: String, + options: StorageDownloadDataRequest.Options? = nil, + progressListener: ProgressListener? = nil, + resultListener: StorageDownloadDataOperation.ResultListener? = nil ) -> StorageDownloadDataOperation { let options = options ?? StorageDownloadDataRequest.Options() let request = StorageDownloadDataRequest(key: key, options: options) - let operation = MockDispatchingStorageDownloadDataOperation(request: request, - progressListener: progressListener, - resultListener: resultListener) + let operation = MockDispatchingStorageDownloadDataOperation( + request: request, + progressListener: progressListener, + resultListener: resultListener + ) return operation } - func downloadFile(key: String, - local: URL, - options: StorageDownloadFileRequest.Options? = nil, - progressListener: ProgressListener? = nil, - resultListener: StorageDownloadFileOperation.ResultListener? = nil + func downloadFile( + key: String, + local: URL, + options: StorageDownloadFileRequest.Options? = nil, + progressListener: ProgressListener? = nil, + resultListener: StorageDownloadFileOperation.ResultListener? = nil ) -> StorageDownloadFileOperation { let options = options ?? StorageDownloadFileRequest.Options() let request = StorageDownloadFileRequest(key: key, local: local, options: options) - let operation = MockDispatchingStorageDownloadFileOperation(request: request, - progressListener: progressListener, - resultListener: resultListener) + let operation = MockDispatchingStorageDownloadFileOperation( + request: request, + progressListener: progressListener, + resultListener: resultListener + ) return operation } - func uploadData(key: String, - data: Data, - options: StorageUploadDataRequest.Options? = nil, - progressListener: ProgressListener? = nil, - resultListener: StorageUploadDataOperation.ResultListener? = nil + func uploadData( + key: String, + data: Data, + options: StorageUploadDataRequest.Options? = nil, + progressListener: ProgressListener? = nil, + resultListener: StorageUploadDataOperation.ResultListener? = nil ) -> StorageUploadDataOperation { let options = options ?? StorageUploadDataRequest.Options() let request = StorageUploadDataRequest(key: key, data: data, options: options) - let operation = MockDispatchingStorageUploadDataOperation(request: request, - progressListener: progressListener, - resultListener: resultListener) + let operation = MockDispatchingStorageUploadDataOperation( + request: request, + progressListener: progressListener, + resultListener: resultListener + ) return operation } - func uploadFile(key: String, - local: URL, - options: StorageUploadFileRequest.Options? = nil, - progressListener: ProgressListener? = nil, - resultListener: StorageUploadFileOperation.ResultListener? = nil + func uploadFile( + key: String, + local: URL, + options: StorageUploadFileRequest.Options? = nil, + progressListener: ProgressListener? = nil, + resultListener: StorageUploadFileOperation.ResultListener? = nil ) -> StorageUploadFileOperation { let options = options ?? StorageUploadFileRequest.Options() let request = StorageUploadFileRequest(key: key, local: local, options: options) - let operation = MockDispatchingStorageUploadFileOperation(request: request, - progressListener: progressListener, - resultListener: resultListener) + let operation = MockDispatchingStorageUploadFileOperation( + request: request, + progressListener: progressListener, + resultListener: resultListener + ) return operation } - func remove(key: String, - options: StorageRemoveRequest.Options? = nil, - resultListener: StorageRemoveOperation.ResultListener? = nil) -> StorageRemoveOperation - { + func remove( + key: String, + options: StorageRemoveRequest.Options? = nil, + resultListener: StorageRemoveOperation.ResultListener? = nil + ) -> StorageRemoveOperation { let options = options ?? StorageRemoveRequest.Options() let request = StorageRemoveRequest(key: key, options: options) - let operation = MockDispatchingStorageRemoveOperation(request: request, - resultListener: resultListener) + let operation = MockDispatchingStorageRemoveOperation( + request: request, + resultListener: resultListener + ) return operation } - func list(options: StorageListRequest.Options?, - resultListener: StorageListOperation.ResultListener?) -> StorageListOperation - { + func list( + options: StorageListRequest.Options?, + resultListener: StorageListOperation.ResultListener? + ) -> StorageListOperation { let options = options ?? StorageListRequest.Options() let request = StorageListRequest(options: options) - let operation = MockDispatchingStorageListOperation(request: request, - resultListener: resultListener) + let operation = MockDispatchingStorageListOperation( + request: request, + resultListener: resultListener + ) return operation } @@ -231,9 +252,10 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { // MARK: - Async API - @discardableResult - func getURL(key: String, - options: StorageGetURLOperation.Request.Options?) async throws -> URL - { + func getURL( + key: String, + options: StorageGetURLOperation.Request.Options? + ) async throws -> URL { let options = options ?? StorageGetURLRequest.Options() let request = StorageGetURLRequest(key: key, options: options) let operation = MockStorageGetURLOperation(request: request) @@ -242,9 +264,10 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { } @discardableResult - public func downloadData(key: String, - options: StorageDownloadDataOperation.Request.Options? = nil) -> StorageDownloadDataTask - { + public func downloadData( + key: String, + options: StorageDownloadDataOperation.Request.Options? = nil + ) -> StorageDownloadDataTask { let options = options ?? StorageDownloadDataRequest.Options() let request = StorageDownloadDataRequest(key: key, options: options) let operation = MockDispatchingStorageDownloadDataOperation(request: request) @@ -253,10 +276,11 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { } @discardableResult - public func downloadFile(key: String, - local: URL, - options: StorageDownloadFileOperation.Request.Options?) -> StorageDownloadFileTask - { + public func downloadFile( + key: String, + local: URL, + options: StorageDownloadFileOperation.Request.Options? + ) -> StorageDownloadFileTask { let options = options ?? StorageDownloadFileRequest.Options() let request = StorageDownloadFileRequest(key: key, local: local, options: options) let operation = MockDispatchingStorageDownloadFileOperation(request: request) @@ -265,10 +289,11 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { } @discardableResult - public func uploadData(key: String, - data: Data, - options: StorageUploadDataOperation.Request.Options?) -> StorageUploadDataTask - { + public func uploadData( + key: String, + data: Data, + options: StorageUploadDataOperation.Request.Options? + ) -> StorageUploadDataTask { let options = options ?? StorageUploadDataRequest.Options() let request = StorageUploadDataRequest(key: key, data: data, options: options) let operation = MockDispatchingStorageUploadDataOperation(request: request) @@ -277,10 +302,11 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { } @discardableResult - public func uploadFile(key: String, - local: URL, - options: StorageUploadFileOperation.Request.Options?) -> StorageUploadFileTask - { + public func uploadFile( + key: String, + local: URL, + options: StorageUploadFileOperation.Request.Options? + ) -> StorageUploadFileTask { let options = options ?? StorageUploadFileRequest.Options() let request = StorageUploadFileRequest(key: key, local: local, options: options) let operation = MockDispatchingStorageUploadFileOperation(request: request) @@ -289,9 +315,10 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { } @discardableResult - public func remove(key: String, - options: StorageRemoveRequest.Options? = nil) async throws -> String - { + public func remove( + key: String, + options: StorageRemoveRequest.Options? = nil + ) async throws -> String { let options = options ?? StorageRemoveRequest.Options() let request = StorageRemoveRequest(key: key, options: options) let operation = MockDispatchingStorageRemoveOperation(request: request) @@ -405,11 +432,13 @@ class MockDispatchingStorageDownloadFileOperation: AmplifyInProcessReportingOper StorageError >, StorageDownloadFileOperation { init(request: Request, progressListener: ProgressListener? = nil, resultListener: ResultListener? = nil) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.downloadFile, - request: request, - inProcessListener: progressListener, - resultListener: resultListener) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.downloadFile, + request: request, + inProcessListener: progressListener, + resultListener: resultListener + ) } func doMockDispatch() { @@ -429,11 +458,13 @@ class MockDispatchingStorageDownloadDataOperation: AmplifyInProcessReportingOper StorageError >, StorageDownloadDataOperation { init(request: Request, progressListener: ProgressListener? = nil, resultListener: ResultListener? = nil) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.downloadData, - request: request, - inProcessListener: progressListener, - resultListener: resultListener) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.downloadData, + request: request, + inProcessListener: progressListener, + resultListener: resultListener + ) } func doMockDispatch(result: StorageDownloadDataOperation.OperationResult = .success(Data())) { @@ -451,10 +482,12 @@ class MockDispatchingStorageGetURLOperation: AmplifyOperation< StorageError >, StorageGetURLOperation { init(request: Request, resultListener: ResultListener? = nil) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.getURL, - request: request, - resultListener: resultListener) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.getURL, + request: request, + resultListener: resultListener + ) } func doMockDispatch(result: StorageGetURLOperation.OperationResult = .success(URL(fileURLWithPath: "/path"))) { @@ -468,10 +501,12 @@ class MockDispatchingStorageListOperation: AmplifyOperation< StorageError >, StorageListOperation { init(request: Request, resultListener: ResultListener? = nil) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.list, - request: request, - resultListener: resultListener) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.list, + request: request, + resultListener: resultListener + ) } func doMockDispatch() { @@ -485,10 +520,12 @@ class MockDispatchingStorageRemoveOperation: AmplifyOperation< StorageError >, StorageRemoveOperation { init(request: Request, resultListener: ResultListener? = nil) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.remove, - request: request, - resultListener: resultListener) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.remove, + request: request, + resultListener: resultListener + ) } func doMockDispatch() { @@ -504,11 +541,13 @@ class MockDispatchingStorageUploadDataOperation: AmplifyInProcessReportingOperat StorageError >, StorageUploadDataOperation { init(request: Request, progressListener: ProgressListener? = nil, resultListener: ResultListener? = nil) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.uploadData, - request: request, - inProcessListener: progressListener, - resultListener: resultListener) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.uploadData, + request: request, + inProcessListener: progressListener, + resultListener: resultListener + ) } func doMockDispatch() { @@ -528,11 +567,13 @@ class MockDispatchingStorageUploadFileOperation: AmplifyInProcessReportingOperat StorageError >, StorageUploadFileOperation { init(request: Request, progressListener: ProgressListener? = nil, resultListener: ResultListener? = nil) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.uploadFile, - request: request, - inProcessListener: progressListener, - resultListener: resultListener) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.uploadFile, + request: request, + inProcessListener: progressListener, + resultListener: resultListener + ) } func doMockDispatch() { @@ -550,8 +591,10 @@ class NonListeningStorageListOperation: AmplifyOperation< StorageError >, StorageListOperation { init(request: Request) { - super.init(categoryType: .storage, - eventName: HubPayload.EventName.Storage.downloadFile, - request: request) + super.init( + categoryType: .storage, + eventName: HubPayload.EventName.Storage.downloadFile, + request: request + ) } } diff --git a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginTests.swift b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginTests.swift index 2f4b42a422..5b2a53a14f 100644 --- a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginTests.swift +++ b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginTests.swift @@ -122,9 +122,11 @@ class DefaultHubPluginTests: XCTestCase { } currentExpectation = expectation(description: "Message was received as expected") - guard try await HubListenerTestUtilities.waitForListener(with: unsubscribeToken, - plugin: plugin, - timeout: 0.5) + guard try await HubListenerTestUtilities.waitForListener( + with: unsubscribeToken, + plugin: plugin, + timeout: 0.5 + ) else { XCTFail("Token with \(unsubscribeToken.id) was not registered") return @@ -141,9 +143,11 @@ class DefaultHubPluginTests: XCTestCase { currentExpectation?.isInverted = true try await isStillRegistered.set( - HubListenerTestUtilities.waitForListener(with: unsubscribeToken, - plugin: plugin, - timeout: 0.5) + HubListenerTestUtilities.waitForListener( + with: unsubscribeToken, + plugin: plugin, + timeout: 0.5 + ) ) XCTAssertFalse(isStillRegistered.get(), "Should not be registered after removeListener") diff --git a/AmplifyTests/CategoryTests/Hub/HubCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Hub/HubCategoryConfigurationTests.swift index 758f4d29b2..3acdc24177 100644 --- a/AmplifyTests/CategoryTests/Hub/HubCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Hub/HubCategoryConfigurationTests.swift @@ -98,9 +98,10 @@ class HubCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) await Amplify.reset() - XCTAssertThrowsError(try Amplify.Hub.getPlugin(for: "MockHubCategoryPlugin"), - "Getting a plugin after reset() should throw") - { error in + XCTAssertThrowsError( + try Amplify.Hub.getPlugin(for: "MockHubCategoryPlugin"), + "Getting a plugin after reset() should throw" + ) { error in guard case HubError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -262,9 +263,10 @@ class HubCategoryConfigurationTests: XCTestCase { ) try Amplify.Hub.configure(using: categoryConfig) - XCTAssertThrowsError(try Amplify.Hub.configure(using: categoryConfig), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.Hub.configure(using: categoryConfig), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return diff --git a/AmplifyTests/CategoryTests/Hub/HubCombineTests.swift b/AmplifyTests/CategoryTests/Hub/HubCombineTests.swift index 9d362627f8..2eb4aed86a 100644 --- a/AmplifyTests/CategoryTests/Hub/HubCombineTests.swift +++ b/AmplifyTests/CategoryTests/Hub/HubCombineTests.swift @@ -43,9 +43,13 @@ class HubCombineTests: XCTestCase { Amplify.Hub.dispatch(to: .auth, payload: HubPayload(eventName: "test")) - await fulfillment(of: [sub1ReceivedValue, - sub2ReceivedValue], - timeout: 0.05) + await fulfillment( + of: [ + sub1ReceivedValue, + sub2ReceivedValue + ], + timeout: 0.05 + ) sub1.cancel() sub2.cancel() @@ -63,9 +67,13 @@ class HubCombineTests: XCTestCase { Amplify.Hub.dispatch(to: .auth, payload: HubPayload(eventName: "test")) Amplify.Hub.dispatch(to: .custom("testChannel"), payload: HubPayload(eventName: "test")) - await fulfillment(of: [receivedValueForAuth, - receivedValueForCustom], - timeout: 0.05) + await fulfillment( + of: [ + receivedValueForAuth, + receivedValueForCustom + ], + timeout: 0.05 + ) authSink.cancel() customSink.cancel() diff --git a/AmplifyTests/CategoryTests/Logging/DefaultLoggingPluginTests.swift b/AmplifyTests/CategoryTests/Logging/DefaultLoggingPluginTests.swift index 91b9ecf586..17e857fef6 100644 --- a/AmplifyTests/CategoryTests/Logging/DefaultLoggingPluginTests.swift +++ b/AmplifyTests/CategoryTests/Logging/DefaultLoggingPluginTests.swift @@ -68,12 +68,16 @@ class DefaultLoggingPluginTests: XCTestCase { verboseMessageIncorrectlyEvaluated.isInverted = true Amplify.Logging.verbose("verbose \(verboseMessageIncorrectlyEvaluated.fulfill())") - await fulfillment(of: [errorMessageCorrectlyEvaluated, - warnMessageIncorrectlyEvaluated, - infoMessageIncorrectlyEvaluated, - debugMessageIncorrectlyEvaluated, - verboseMessageIncorrectlyEvaluated], - timeout: 0.1) + await fulfillment( + of: [ + errorMessageCorrectlyEvaluated, + warnMessageIncorrectlyEvaluated, + infoMessageIncorrectlyEvaluated, + debugMessageIncorrectlyEvaluated, + verboseMessageIncorrectlyEvaluated + ], + timeout: 0.1 + ) } /// - Given: default configuration @@ -102,11 +106,15 @@ class DefaultLoggingPluginTests: XCTestCase { infoMessageIncorrectlyEvaluatedAgain.isInverted = true Amplify.Logging.info("info \(infoMessageIncorrectlyEvaluatedAgain.fulfill())") - await fulfillment(of: [warnMessageCorrectlyEvaluated, - infoMessageIncorrectlyEvaluated, - warnMessageIncorrectlyEvaluated, - infoMessageIncorrectlyEvaluatedAgain], - timeout: 0.1) + await fulfillment( + of: [ + warnMessageCorrectlyEvaluated, + infoMessageIncorrectlyEvaluated, + warnMessageIncorrectlyEvaluated, + infoMessageIncorrectlyEvaluatedAgain + ], + timeout: 0.1 + ) } /// Although we can't assert it, the messages in the console log are expected to have different "category" tags @@ -150,10 +158,14 @@ class DefaultLoggingPluginTests: XCTestCase { logger1.info("logger1 \(logger1MessageCorrectlyEvaluated.fulfill())") logger2.info("logger2 \(logger2MessageIncorrectlyEvaluated.fulfill())") - await fulfillment(of: [logger1MessageCorrectlyEvaluated, - logger2MessageIncorrectlyEvaluated, - globalMessageCorrectlyEvaluated], - timeout: 0.1) + await fulfillment( + of: [ + logger1MessageCorrectlyEvaluated, + logger2MessageIncorrectlyEvaluated, + globalMessageCorrectlyEvaluated + ], + timeout: 0.1 + ) } /// - Given: default configuration diff --git a/AmplifyTests/CategoryTests/Logging/LoggingCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Logging/LoggingCategoryConfigurationTests.swift index 1395ac6120..5e90929a34 100644 --- a/AmplifyTests/CategoryTests/Logging/LoggingCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Logging/LoggingCategoryConfigurationTests.swift @@ -82,9 +82,10 @@ class LoggingCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) await Amplify.reset() - XCTAssertThrowsError(try Amplify.Logging.getPlugin(for: "MockLoggingCategoryPlugin"), - "Getting a plugin after reset() should throw") - { error in + XCTAssertThrowsError( + try Amplify.Logging.getPlugin(for: "MockLoggingCategoryPlugin"), + "Getting a plugin after reset() should throw" + ) { error in guard case LoggingError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -250,9 +251,10 @@ class LoggingCategoryConfigurationTests: XCTestCase { ) try Amplify.Logging.configure(using: categoryConfig) - XCTAssertThrowsError(try Amplify.Logging.configure(using: categoryConfig), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.Logging.configure(using: categoryConfig), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return diff --git a/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryConfigurationTests.swift index a19b4baf08..7f9277b4dc 100644 --- a/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryConfigurationTests.swift @@ -51,9 +51,10 @@ class PushNotificationsCategoryConfigurationTests: XCTestCase { try Amplify.add(plugin: plugin) try Amplify.configure(createAmplifyConfig()) - XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.add(plugin: plugin), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -67,9 +68,10 @@ class PushNotificationsCategoryConfigurationTests: XCTestCase { let categoryConfig = createCategoryConfig() try Amplify.Notifications.Push.configure(using: categoryConfig) - XCTAssertThrowsError(try Amplify.Notifications.Push.configure(using: categoryConfig), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.Notifications.Push.configure(using: categoryConfig), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -206,9 +208,10 @@ class PushNotificationsCategoryConfigurationTests: XCTestCase { try Amplify.configure(createAmplifyConfig()) await Amplify.reset() - XCTAssertThrowsError(try Amplify.Notifications.Push.getPlugin(for: "MockPushNotificationsCategoryPlugin"), - "Getting a plugin after reset() should throw") - { error in + XCTAssertThrowsError( + try Amplify.Notifications.Push.getPlugin(for: "MockPushNotificationsCategoryPlugin"), + "Getting a plugin after reset() should throw" + ) { error in guard case PushNotificationsError.configuration = error else { XCTFail("Expected PushNotificationsError.configuration error") return diff --git a/AmplifyTests/CategoryTests/Predictions/PredictionsCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Predictions/PredictionsCategoryConfigurationTests.swift index ede6a88c1b..f4c41a1c8d 100644 --- a/AmplifyTests/CategoryTests/Predictions/PredictionsCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Predictions/PredictionsCategoryConfigurationTests.swift @@ -220,9 +220,10 @@ class PredictionsCategoryConfigurationTests: XCTestCase { ) try Amplify.Predictions.configure(using: config) - XCTAssertThrowsError(try Amplify.Predictions.configure(using: config), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.Predictions.configure(using: config), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return diff --git a/AmplifyTests/CategoryTests/Storage/StorageCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Storage/StorageCategoryConfigurationTests.swift index 0cf8e8048a..50ed508a32 100644 --- a/AmplifyTests/CategoryTests/Storage/StorageCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Storage/StorageCategoryConfigurationTests.swift @@ -81,9 +81,10 @@ class StorageCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) await Amplify.reset() - XCTAssertThrowsError(try Amplify.Storage.getPlugin(for: "MockStorageCategoryPlugin"), - "Getting a plugin after reset() should throw") - { error in + XCTAssertThrowsError( + try Amplify.Storage.getPlugin(for: "MockStorageCategoryPlugin"), + "Getting a plugin after reset() should throw" + ) { error in guard case StorageError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -257,9 +258,10 @@ class StorageCategoryConfigurationTests: XCTestCase { ) try Amplify.Storage.configure(using: categoryConfig) - XCTAssertThrowsError(try Amplify.Storage.configure(using: categoryConfig), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.Storage.configure(using: categoryConfig), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -335,9 +337,10 @@ class StorageCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) - XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") - { error in + XCTAssertThrowsError( + try Amplify.add(plugin: plugin), + "configure() an already configured plugin should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return diff --git a/AmplifyTests/CoreTests/AmplifyConfigurationInitializationTests.swift b/AmplifyTests/CoreTests/AmplifyConfigurationInitializationTests.swift index af9794abb8..bfdcc790e5 100644 --- a/AmplifyTests/CoreTests/AmplifyConfigurationInitializationTests.swift +++ b/AmplifyTests/CoreTests/AmplifyConfigurationInitializationTests.swift @@ -174,16 +174,20 @@ class AmplifyConfigurationInitializationTests: XCTestCase { /// Creates the directory used as the container for the test bundle; each test will need this. static func makeTempDir() throws { - try FileManager.default.createDirectory(at: tempDir, - withIntermediateDirectories: true) + try FileManager.default.createDirectory( + at: tempDir, + withIntermediateDirectories: true + ) } /// Creates a Bundle object from the container directory static func makeTestBundle(withConfigFileName: Data? = nil) throws -> Bundle { let customBundleDir = tempDir.appendingPathComponent("TestBundle.bundle") - try FileManager.default.createDirectory(at: customBundleDir, - withIntermediateDirectories: true) + try FileManager.default.createDirectory( + at: customBundleDir, + withIntermediateDirectories: true + ) guard let testBundle = Bundle(path: customBundleDir.path) else { throw "Could not create test bundle at \(customBundleDir.path)" diff --git a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationChainedTests.swift b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationChainedTests.swift index 4d5dff4464..d3ece1e6a6 100644 --- a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationChainedTests.swift +++ b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationChainedTests.swift @@ -57,10 +57,14 @@ class AmplifyInProcessReportingOperationChainedTests: XCTestCase { mockOp1.main() mockOp2.main() - await fulfillment(of: [receivedValue, - receivedFailure, - receivedFinished], - timeout: 0.05) + await fulfillment( + of: [ + receivedValue, + receivedFailure, + receivedFinished + ], + timeout: 0.05 + ) sink.cancel() } @@ -112,10 +116,14 @@ class AmplifyInProcessReportingOperationChainedTests: XCTestCase { mockOp1.main() mockOp2.main() - await fulfillment(of: [receivedValue, - receivedFailure, - receivedFinished], - timeout: 0.05) + await fulfillment( + of: [ + receivedValue, + receivedFailure, + receivedFinished + ], + timeout: 0.05 + ) sink.cancel() } @@ -162,10 +170,14 @@ class AmplifyInProcessReportingOperationChainedTests: XCTestCase { mockOp1.main() mockOp2.main() - await fulfillment(of: [receivedValue, - receivedFailure, - receivedFinished], - timeout: 0.05) + await fulfillment( + of: [ + receivedValue, + receivedFailure, + receivedFinished + ], + timeout: 0.05 + ) sink.cancel() } diff --git a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift index a07b70c55d..33f10051f6 100644 --- a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift +++ b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift @@ -53,13 +53,17 @@ class AmplifyInProcessReportingOperationCombineTests: XCTestCase { let operation = makeOperation(using: responder) operation.main() - await fulfillment(of: [receivedResultValue, - receivedResultFailure, - receivedResultFinished, - receivedInProcessValue, - receivedInProcessFailure, - receivedInProcessFinished], - timeout: 0.05) + await fulfillment( + of: [ + receivedResultValue, + receivedResultFailure, + receivedResultFinished, + receivedInProcessValue, + receivedInProcessFailure, + receivedInProcessFinished + ], + timeout: 0.05 + ) } func testResultPublisherFails() async { @@ -75,13 +79,17 @@ class AmplifyInProcessReportingOperationCombineTests: XCTestCase { let operation = makeOperation(using: responder) operation.main() - await fulfillment(of: [receivedResultValue, - receivedResultFailure, - receivedResultFinished, - receivedInProcessValue, - receivedInProcessFailure, - receivedInProcessFinished], - timeout: 0.05) + await fulfillment( + of: [ + receivedResultValue, + receivedResultFailure, + receivedResultFinished, + receivedInProcessValue, + receivedInProcessFailure, + receivedInProcessFinished + ], + timeout: 0.05 + ) } func testResultPublisherCancels() async { @@ -99,13 +107,17 @@ class AmplifyInProcessReportingOperationCombineTests: XCTestCase { let operation = makeOperation(using: responder) operation.cancel() - await fulfillment(of: [receivedResultValue, - receivedResultFailure, - receivedResultFinished, - receivedInProcessValue, - receivedInProcessFailure, - receivedInProcessFinished], - timeout: 0.05) + await fulfillment( + of: [ + receivedResultValue, + receivedResultFailure, + receivedResultFinished, + receivedInProcessValue, + receivedInProcessFailure, + receivedInProcessFinished + ], + timeout: 0.05 + ) } func makeOperation( diff --git a/AmplifyTests/CoreTests/AmplifyOutputsInitializationTests.swift b/AmplifyTests/CoreTests/AmplifyOutputsInitializationTests.swift index 12c2c3faae..5207a06748 100644 --- a/AmplifyTests/CoreTests/AmplifyOutputsInitializationTests.swift +++ b/AmplifyTests/CoreTests/AmplifyOutputsInitializationTests.swift @@ -137,16 +137,20 @@ class AmplifyOutputsInitializationTests: XCTestCase { /// Creates the directory used as the container for the test bundle; each test will need this. static func makeTempDir() throws { - try FileManager.default.createDirectory(at: tempDir, - withIntermediateDirectories: true) + try FileManager.default.createDirectory( + at: tempDir, + withIntermediateDirectories: true + ) } /// Creates a Bundle object from the container directory static func makeTestBundle() throws -> Bundle { let customBundleDir = tempDir.appendingPathComponent("TestBundle.bundle") - try FileManager.default.createDirectory(at: customBundleDir, - withIntermediateDirectories: true) + try FileManager.default.createDirectory( + at: customBundleDir, + withIntermediateDirectories: true + ) guard let testBundle = Bundle(path: customBundleDir.path) else { throw "Could not create test bundle at \(customBundleDir.path)" diff --git a/AmplifyTests/CoreTests/AmplifyPublisherTests.swift b/AmplifyTests/CoreTests/AmplifyPublisherTests.swift index c9cf3af7bf..aa040fabce 100644 --- a/AmplifyTests/CoreTests/AmplifyPublisherTests.swift +++ b/AmplifyTests/CoreTests/AmplifyPublisherTests.swift @@ -274,10 +274,11 @@ class AmplifyPublisherTests: XCTestCase { sink.cancel() } - private func send(input: [Element], - sequence: AmplifyAsyncSequence, - finish: Bool = true) - { + private func send( + input: [Element], + sequence: AmplifyAsyncSequence, + finish: Bool = true + ) { for value in input { sequence.send(value) } @@ -286,10 +287,11 @@ class AmplifyPublisherTests: XCTestCase { } } - private func send(input: [Element], - throwingSequence: AmplifyAsyncThrowingSequence, - finish: Bool = true) - { + private func send( + input: [Element], + throwingSequence: AmplifyAsyncThrowingSequence, + finish: Bool = true + ) { for value in input { throwingSequence.send(value) } diff --git a/AmplifyTests/CoreTests/ConfigurationTests.swift b/AmplifyTests/CoreTests/ConfigurationTests.swift index cc9856de7e..04a2e21b86 100644 --- a/AmplifyTests/CoreTests/ConfigurationTests.swift +++ b/AmplifyTests/CoreTests/ConfigurationTests.swift @@ -68,9 +68,10 @@ class ConfigurationTests: XCTestCase { func testMultipleConfigureCallsThrowError() throws { let amplifyConfig = AmplifyConfiguration() try Amplify.configure(amplifyConfig) - XCTAssertThrowsError(try Amplify.configure(amplifyConfig), - "Subsequent calls to configure should throw") - { error in + XCTAssertThrowsError( + try Amplify.configure(amplifyConfig), + "Subsequent calls to configure should throw" + ) { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured error") return @@ -91,9 +92,10 @@ class ConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) XCTAssertNotNil(try Amplify.Logging.getPlugin(for: "MockLoggingCategoryPlugin")) await Amplify.reset() - XCTAssertThrowsError(try Amplify.Logging.getPlugin(for: "MockLoggingCategoryPlugin"), - "Plugins should be reset") - { error in + XCTAssertThrowsError( + try Amplify.Logging.getPlugin(for: "MockLoggingCategoryPlugin"), + "Plugins should be reset" + ) { error in guard case LoggingError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin error") return diff --git a/AmplifyTests/CoreTests/Model+CodableTests.swift b/AmplifyTests/CoreTests/Model+CodableTests.swift index 264ad5a35d..ef31fbc9a2 100644 --- a/AmplifyTests/CoreTests/Model+CodableTests.swift +++ b/AmplifyTests/CoreTests/Model+CodableTests.swift @@ -25,10 +25,12 @@ class ModelCodableTests: XCTestCase { func testToJSON() throws { let createdAt = Temporal.DateTime(Date(timeIntervalSince1970: 1_000_000.123), timeZone: .utc) - let post = Post(id: "post-1", - title: "title", - content: "content", - createdAt: createdAt) + let post = Post( + id: "post-1", + title: "title", + content: "content", + createdAt: createdAt + ) let j = try post.toJSON() print(j) XCTAssertEqual(try post.toJSON(), postJSONWithFractionalSeconds) diff --git a/AmplifyTests/CoreTests/Operations/FastOperation.swift b/AmplifyTests/CoreTests/Operations/FastOperation.swift index a037bc18ee..038aba947d 100644 --- a/AmplifyTests/CoreTests/Operations/FastOperation.swift +++ b/AmplifyTests/CoreTests/Operations/FastOperation.swift @@ -76,10 +76,12 @@ public class FastOperation: AmplifyOperation(_ task: AmplifyCommandTaskExecutor, - args: TaskArgs, - prevResults: inout [AmplifyCommandTaskResult]) -> Bool - { + private func exec( + _ task: AmplifyCommandTaskExecutor, + args: TaskArgs, + prevResults: inout [AmplifyCommandTaskResult] + ) -> Bool { let output = task(environment, args) switch output { case .failure: diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportConfig.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportConfig.swift index 2818c529c5..4b79f8ca96 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportConfig.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportConfig.swift @@ -10,27 +10,29 @@ import Foundation enum ImportConfigTasks { static func amplifyFolderExist( environment: AmplifyCommandEnvironment, - args: CommandImportConfig.TaskArgs) -> AmplifyCommandTaskResult - { + args: CommandImportConfig.TaskArgs + ) -> AmplifyCommandTaskResult { guard environment.directoryExists(atPath: "amplify") else { return .failure(AmplifyCommandError( - .folderNotFound, - errorDescription: "Amplify project not found at \(environment.basePath).", - recoverySuggestion: "Run `amplify init` to initialize an Amplify project.")) + .folderNotFound, + errorDescription: "Amplify project not found at \(environment.basePath).", + recoverySuggestion: "Run `amplify init` to initialize an Amplify project." + )) } return .success("Amplify project found.") } static func configFilesExist( environment: AmplifyCommandEnvironment, - args: CommandImportConfig.TaskArgs) -> AmplifyCommandTaskResult - { + args: CommandImportConfig.TaskArgs + ) -> AmplifyCommandTaskResult { for file in args.configFiles { if !environment.fileExists(atPath: file) { return .failure(AmplifyCommandError( .fileNotFound, errorDescription: "\(file) not found.", - recoverySuggestion: "Verify the current Amplify project has been initialized successfully.")) + recoverySuggestion: "Verify the current Amplify project has been initialized successfully." + )) } } return .success("Amplify config files found.") @@ -38,17 +40,19 @@ enum ImportConfigTasks { static func addConfigFilesToXcodeProject( environment: AmplifyCommandEnvironment, - args: CommandImportConfig.TaskArgs) -> AmplifyCommandTaskResult - { + args: CommandImportConfig.TaskArgs + ) -> AmplifyCommandTaskResult { let configFiles = args.configFiles.map { environment.createXcodeFile(withPath: environment.path(for: $0), ofType: .resource) } let projectPath = environment.basePath do { - try environment.addFilesToXcodeProject(projectPath: projectPath, - files: configFiles, - toGroup: args.configGroup, - inTarget: .primary) + try environment.addFilesToXcodeProject( + projectPath: projectPath, + files: configFiles, + toGroup: args.configGroup, + inTarget: .primary + ) return .success("Successfully updated project \(projectPath).") } catch { if let underlyingError = error as? AmplifyCommandError { diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportModels.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportModels.swift index 692c26abdd..f54af3b661 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportModels.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportModels.swift @@ -9,9 +9,10 @@ import Foundation import PathKit enum CommandImportModelsTasks { - static func projectHasGeneratedModels(environment: AmplifyCommandEnvironment, - args: CommandImportModels.TaskArgs) -> AmplifyCommandTaskResult - { + static func projectHasGeneratedModels( + environment: AmplifyCommandEnvironment, + args: CommandImportModels.TaskArgs + ) -> AmplifyCommandTaskResult { let modelsPath = environment.path(for: args.generatedModelsPath) guard environment.directoryExists(atPath: modelsPath) else { do { @@ -21,7 +22,8 @@ enum CommandImportModelsTasks { AmplifyCommandError( .folderNotFound, errorDescription: "Unable to create a new folder for models at path: \(modelsPath)", - recoverySuggestion: "Run amplify codegen models.")) + recoverySuggestion: "Run amplify codegen models." + )) } return .success("Amplify models folder created at \(modelsPath)") @@ -30,9 +32,10 @@ enum CommandImportModelsTasks { return .success("Amplify models folder found at \(modelsPath)") } - static func addGeneratedModelsToProject(environment: AmplifyCommandEnvironment, - args: CommandImportModels.TaskArgs) -> AmplifyCommandTaskResult - { + static func addGeneratedModelsToProject( + environment: AmplifyCommandEnvironment, + args: CommandImportModels.TaskArgs + ) -> AmplifyCommandTaskResult { let models = environment.glob(pattern: "\(args.generatedModelsPath)/*.swift").map { environment.createXcodeFile(withPath: $0, ofType: .source) } @@ -42,7 +45,8 @@ enum CommandImportModelsTasks { projectPath: environment.basePath, files: models, toGroup: args.modelsGroup, - inTarget: .primary) + inTarget: .primary + ) let addedModels = models.map { Path($0.path).lastComponent } return .success("Successfully added models \(addedModels) to '\(args.modelsGroup)' group.") diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/AmplifyCommandEnvironment.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/AmplifyCommandEnvironment.swift index 38fd26a9d9..f7c189d5c0 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/AmplifyCommandEnvironment.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/AmplifyCommandEnvironment.swift @@ -47,10 +47,12 @@ public protocol AmplifyCommandEnvironmentXcode { /// Reads an Xcode project file at `projectPath`, retrieves or creates a group `group` if it doesn't exist /// and adds `files` to it - func addFilesToXcodeProject(projectPath: String, - files: [XcodeProjectFile], - toGroup group: String, - inTarget target: XcodeProjectTarget) throws + func addFilesToXcodeProject( + projectPath: String, + files: [XcodeProjectFile], + toGroup group: String, + inTarget target: XcodeProjectTarget + ) throws } public typealias AmplifyCommandEnvironment = AmplifyCommandEnvironmentFileManager & AmplifyCommandEnvironmentXcode diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/CommandEnvironment.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/CommandEnvironment.swift index 30aa5dd06a..67c0b853ff 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/CommandEnvironment.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/CommandEnvironment.swift @@ -60,7 +60,8 @@ public extension CommandEnvironment { .folderNotFound, errorDescription: "Folder \(fullPath) not found", recoverySuggestion: nil, - error: nil) + error: nil + ) } do { let content = try fileManager.contentsOfDirectory(atPath: fullPath) @@ -91,7 +92,8 @@ public extension CommandEnvironment { .xcodeProject, errorDescription: "Unable to find an Xcode project (i.e. `xcodeproj` file) in directory: \(path)", recoverySuggestion: "Please create a new Xcode project or import one at \(path).", - error: XcodeProjectError.notFound(path: path)) + error: XcodeProjectError.notFound(path: path) + ) } let projectName = xcodeProjFiles[0] @@ -106,17 +108,19 @@ public extension CommandEnvironment { projectPath path: String, files: [XcodeProjectFile], toGroup group: String, - inTarget target: XcodeProjectTarget) throws - { + inTarget target: XcodeProjectTarget + ) throws { do { let xcodeProject = try loadFirstXcodeProject(fromDirectory: path) try xcodeProject.add(files: files, toGroup: group, inTarget: target) try xcodeProject.synchronize() } catch { if case let XcodeProjectError.targetNotFound(name: targetName) = error { - throw AmplifyCommandError(.xcodeProject, - errorDescription: "Target \(targetName) not found", - recoverySuggestion: "Manually add Amplify files to your Xcode project.") + throw AmplifyCommandError( + .xcodeProject, + errorDescription: "Target \(targetName) not found", + recoverySuggestion: "Manually add Amplify files to your Xcode project." + ) } throw AmplifyCommandError(.xcodeProject, error: error) } diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+Utils.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+Utils.swift index 6d2090a29b..80eb115e94 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+Utils.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+Utils.swift @@ -16,8 +16,10 @@ public extension FileManager { func resolveHomeDirectoryIn(path: String) -> String { if let first = path.first, first == "~" { - return path.replacingCharacters(in: ...path.startIndex, - with: FileManager.default.homeDirectoryForCurrentUser.path) + return path.replacingCharacters( + in: ...path.startIndex, + with: FileManager.default.homeDirectoryForCurrentUser.path + ) } return path } diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProj+Helpers.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProj+Helpers.swift index d0d283f5f1..c88cce8423 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProj+Helpers.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProj+Helpers.swift @@ -38,9 +38,10 @@ extension XcodeProj { // MARK: Add files to project extension XcodeProj { - func targets(named targetName: String, - ofType productType: PBXProductType) -> [PBXTarget] - { + func targets( + named targetName: String, + ofType productType: PBXProductType + ) -> [PBXTarget] { pbxproj.targets(named: targetName).filter { $0.productType == productType } } diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProject.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProject.swift index 78c4ad08b8..9e3b85a36d 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProject.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProject.swift @@ -81,10 +81,11 @@ struct XcodeProject { // MARK: Add files extension XcodeProject { - func add(files: [XcodeProjectFile], - toGroup group: String, - inTarget target: XcodeProjectTarget) throws - { + func add( + files: [XcodeProjectFile], + toGroup group: String, + inTarget target: XcodeProjectTarget + ) throws { guard let mainProject = project.mainProject() else { throw XcodeProjectError.noPbxProjFound } diff --git a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Commands/CommandImportModelsTasksTests.swift b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Commands/CommandImportModelsTasksTests.swift index dfdb5428bf..e9705ed45d 100644 --- a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Commands/CommandImportModelsTasksTests.swift +++ b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Commands/CommandImportModelsTasksTests.swift @@ -32,24 +32,24 @@ class CommandImportModelsTasksTests: XCTestCase { class CustomEnvironment: MockAmplifyCommandEnvironment { override func glob(pattern: String) -> [String] { [ - "Todo.swift", - "Note.swift" - ] + "Todo.swift", + "Note.swift" + ] } } let environment = CustomEnvironment(basePath: basePath, fileManager: fileManager) if case let .failure(error) = CommandImportModelsTasks.projectHasGeneratedModels( environment: environment, - args: taskArgs) - { + args: taskArgs + ) { XCTFail("projectHasGeneratedModels failed with error \(error)") } if case let .failure(error) = CommandImportModelsTasks.addGeneratedModelsToProject( environment: environment, - args: taskArgs) - { + args: taskArgs + ) { XCTFail("addGeneratedModelsToProject failed with error \(error)") } XCTAssertEqual(environment.createXcodeFileCalledTimes, 2) // one call for each model file found diff --git a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Core/AmplifyCommandEnvironmentTests.swift b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Core/AmplifyCommandEnvironmentTests.swift index 859b24f313..803776669b 100644 --- a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Core/AmplifyCommandEnvironmentTests.swift +++ b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Core/AmplifyCommandEnvironmentTests.swift @@ -149,9 +149,11 @@ class AmplifyCommandEnvironmentTests: XCTestCase { } let environment = CommandEnvironment(basePath: basePath, fileManager: DirNotFoundFileManager()) let file = environment.createXcodeFile(withPath: "File.swift", ofType: .source) - XCTAssertThrowsError(try environment.addFilesToXcodeProject(projectPath: "project", - files: [file], - toGroup: "group", - inTarget: .primary)) + XCTAssertThrowsError(try environment.addFilesToXcodeProject( + projectPath: "project", + files: [file], + toGroup: "group", + inTarget: .primary + )) } } diff --git a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Core/AmplifyCommandErrorTests.swift b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Core/AmplifyCommandErrorTests.swift index 68accff3a3..97179946a2 100644 --- a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Core/AmplifyCommandErrorTests.swift +++ b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Core/AmplifyCommandErrorTests.swift @@ -28,10 +28,11 @@ class AmplifyCommandErrorTests: XCTestCase { let recoveryMessage = "Recovery message" let tasksResults: [AmplifyCommandTaskResult] = [ .failure(AmplifyCommandError( - .folderNotFound, - errorDescription: errorDescription, - recoverySuggestion: recoveryMessage, - error: error)), + .folderNotFound, + errorDescription: errorDescription, + recoverySuggestion: recoveryMessage, + error: error + )), .success("Task 1 success message"), .success("Task 2 success message") ] diff --git a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyCommandEnvironment.swift b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyCommandEnvironment.swift index b122dedbee..25bee3364b 100644 --- a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyCommandEnvironment.swift +++ b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyCommandEnvironment.swift @@ -66,11 +66,12 @@ class MockAmplifyCommandEnvironment: Mock, AmplifyCommandEnvironment { return XcodeProjectFile(path, type: type) } - func addFilesToXcodeProject(projectPath path: String, - files: [XcodeProjectFile], - toGroup group: String, - inTarget: XcodeProjectTarget) throws - { + func addFilesToXcodeProject( + projectPath path: String, + files: [XcodeProjectFile], + toGroup group: String, + inTarget: XcodeProjectTarget + ) throws { captureCall("addFilesToXcodeProject") } }