From 78bd9ffc3b5e222af3929926a01de1e6a3ce02ef Mon Sep 17 00:00:00 2001 From: Tuan Pham Date: Tue, 3 Sep 2024 13:12:53 -0500 Subject: [PATCH] chore: resolve swiftformat errors and warnings --- AmplifyTestApp/AppDelegate.swift | 2 +- .../Helpers/AmplifyAssertions.swift | 6 +- .../Helpers/AuthSignInHelper.swift | 2 +- .../Helpers/HubListenerTestUtilities.swift | 5 +- AmplifyTestCommon/Helpers/TypeRegistry.swift | 2 +- .../Mocks/MockAPICategoryPlugin.swift | 44 +++--- .../Mocks/MockAuthCategoryPlugin.swift | 32 +++-- .../Mocks/MockCredentialsProvider.swift | 4 +- .../Mocks/MockDataStoreCategoryPlugin.swift | 127 ++++++++++------- .../Mocks/MockHubCategoryPlugin.swift | 6 +- .../Mocks/MockLoggingCategoryPlugin.swift | 8 +- .../Mocks/MockPredictionsCategoryPlugin.swift | 2 +- .../MockPushNotificationsCategoryPlugin.swift | 12 +- .../Mocks/MockStorageCategoryPlugin.swift | 36 +++-- AmplifyTestCommon/Models/AmplifyModels.swift | 2 +- AmplifyTestCommon/Models/Article+Schema.swift | 8 +- AmplifyTestCommon/Models/Article.swift | 3 +- .../Models/Associations/Author+Schema.swift | 12 +- .../Models/Associations/Author.swift | 3 +- .../Models/Associations/Book+Schema.swift | 12 +- .../Models/Associations/Book.swift | 3 +- .../Associations/BookAuthor+Schema.swift | 12 +- .../Models/Associations/BookAuthor.swift | 3 +- .../Associations/UserAccount+Schema.swift | 8 +- .../Models/Associations/UserAccount.swift | 3 +- .../Associations/UserProfile+Schema.swift | 8 +- .../Models/Associations/UserProfile.swift | 3 +- .../Models/Collection/1/Project1+Schema.swift | 9 +- .../Models/Collection/1/Project1.swift | 3 +- .../Models/Collection/1/Team1+Schema.swift | 9 +- .../Models/Collection/1/Team1.swift | 3 +- .../Models/Collection/2/Project2+Schema.swift | 9 +- .../Models/Collection/2/Project2.swift | 3 +- .../Models/Collection/2/Team2+Schema.swift | 9 +- .../Models/Collection/2/Team2.swift | 3 +- .../Models/Collection/3/Comment3+Schema.swift | 9 +- .../Models/Collection/3/Comment3.swift | 3 +- .../Models/Collection/3/Post3+Schema.swift | 9 +- .../Models/Collection/3/Post3.swift | 3 +- .../Models/Collection/4/Comment4+Schema.swift | 9 +- .../Models/Collection/4/Comment4.swift | 17 +-- .../Models/Collection/4/Post4+Schema.swift | 9 +- .../Models/Collection/4/Post4.swift | 3 +- .../Models/Collection/5/Post5+Schema.swift | 9 +- .../Models/Collection/5/Post5.swift | 3 +- .../Collection/5/PostEditor5+Schema.swift | 9 +- .../Models/Collection/5/PostEditor5.swift | 3 +- .../Models/Collection/5/User5+Schema.swift | 9 +- .../Models/Collection/5/User5.swift | 3 +- .../Models/Collection/6/Blog6+Schema.swift | 9 +- .../Models/Collection/6/Blog6.swift | 3 +- .../Models/Collection/6/Comment6+Schema.swift | 9 +- .../Models/Collection/6/Comment6.swift | 3 +- .../Models/Collection/6/Post6+Schema.swift | 9 +- .../Models/Collection/6/Post6.swift | 3 +- AmplifyTestCommon/Models/Comment+Schema.swift | 13 +- AmplifyTestCommon/Models/Comment.swift | 19 +-- .../CommentWithCompositeKey+Schema.swift | 16 ++- .../CommentWithCompositeKey.swift | 8 +- ...mmentWithCompositeKeyAndIndex+Schema.swift | 16 ++- .../CommentWithCompositeKeyAndIndex.swift | 8 +- ...ithCompositeKeyUnidirectional+Schema.swift | 16 ++- ...ommentWithCompositeKeyUnidirectional.swift | 8 +- .../ModelCompositeIntPk+Schema.swift | 13 +- .../ModelCompositeIntPk.swift | 8 +- .../ModelCompositePk+Schema.swift | 13 +- .../CustomPrimaryKey/ModelCompositePk.swift | 8 +- .../ModelCompositePkBelongsTo+Schema.swift | 13 +- .../ModelCompositePkBelongsTo.swift | 8 +- ...delCompositePkWithAssociation+Schema.swift | 13 +- .../ModelCompositePkWithAssociation.swift | 8 +- .../ModelCustomPKDefined.swift | 8 +- .../ModelCustomPkDefined+Schema.swift | 13 +- .../ModelExplicitCustomPk+Schema.swift | 13 +- .../ModelExplicitCustomPk.swift | 5 +- .../ModelExplicitDefaultPk+Schema.swift | 13 +- .../ModelExplicitDefaultPk.swift | 8 +- .../ModelImplicitDefaultPk+Schema.swift | 9 +- .../ModelImplicitDefaultPk.swift | 8 +- .../PostTagsWithCompositeKey+Schema.swift | 9 +- .../PostTagsWithCompositeKey.swift | 8 +- .../PostWithCompositeKey+Schema.swift | 16 ++- .../PostWithCompositeKey.swift | 8 +- .../PostWithCompositeKeyAndIndex+Schema.swift | 16 ++- .../PostWithCompositeKeyAndIndex.swift | 8 +- ...ithCompositeKeyUnidirectional+Schema.swift | 16 ++- .../PostWithCompositeKeyUnidirectional.swift | 8 +- .../PostWithTagsCompositeKey+Schema.swift | 16 ++- .../PostWithTagsCompositeKey.swift | 8 +- .../TagWithCompositeKey+Schema.swift | 16 ++- .../TagWithCompositeKey.swift | 8 +- .../Models/CustomerOrder+Schema.swift | 9 +- AmplifyTestCommon/Models/CustomerOrder.swift | 3 +- .../Models/Deprecated/DeprecatedTodo.swift | 13 +- .../M2MPostEditorUser/M2MPost+Schema.swift | 9 +- .../Models/M2MPostEditorUser/M2MPost.swift | 3 +- .../M2MPostEditor+Schema.swift | 9 +- .../M2MPostEditorUser/M2MPostEditor.swift | 3 +- .../M2MPostEditorUser/M2MUser+Schema.swift | 9 +- .../Models/M2MPostEditorUser/M2MUser.swift | 3 +- .../Models/NonModel/Category.swift | 8 +- AmplifyTestCommon/Models/NonModel/Color.swift | 8 +- .../Models/NonModel/DynamicEmbedded.swift | 5 +- .../Models/NonModel/DynamicModel.swift | 7 +- .../Models/NonModel/Section.swift | 8 +- .../Models/NonModel/Todo+Schema.swift | 9 +- AmplifyTestCommon/Models/NonModel/Todo.swift | 4 +- .../OGCScenarioBMGroupPost+Schema.swift | 9 +- .../Models/OGCScenarioBMGroupPost.swift | 3 +- .../Models/OGCScenarioBPost+Schema.swift | 9 +- .../Models/OGCScenarioBPost.swift | 3 +- AmplifyTestCommon/Models/Post+Schema.swift | 13 +- AmplifyTestCommon/Models/Post.swift | 3 +- .../Models/PostCommentModelRegistration.swift | 2 +- .../Models/QPredGen+Schema.swift | 9 +- AmplifyTestCommon/Models/QPredGen.swift | 4 +- AmplifyTestCommon/Models/Record+Schema.swift | 12 +- AmplifyTestCommon/Models/Record.swift | 11 +- .../Models/RecordCover+Schema.swift | 12 +- AmplifyTestCommon/Models/RecordCover.swift | 7 +- .../Models/ReservedWords/Group+Schema.swift | 10 +- .../Models/ReservedWords/Group.swift | 2 +- .../Models/ReservedWords/Row+Schema.swift | 10 +- .../Models/ReservedWords/Row.swift | 5 +- .../ReservedWords/Transaction+Schema.swift | 11 +- .../Models/ReservedWords/Transaction.swift | 3 +- .../Models/Restaurant/Dish+Schema.swift | 9 +- .../Models/Restaurant/Dish.swift | 3 +- .../Models/Restaurant/Menu+Schema.swift | 9 +- .../Models/Restaurant/Menu.swift | 3 +- .../Models/Restaurant/Restaurant+Schema.swift | 9 +- .../Models/Restaurant/Restaurant.swift | 3 +- .../Models/Scalar/EnumTestModel+Schema.swift | 9 +- .../Models/Scalar/EnumTestModel.swift | 3 +- .../Scalar/ListIntContainer+Schema.swift | 9 +- .../Models/Scalar/ListIntContainer.swift | 3 +- .../Scalar/ListStringContainer+Schema.swift | 9 +- .../Models/Scalar/ListStringContainer.swift | 3 +- .../Models/Scalar/Nested+Schema.swift | 9 +- .../Scalar/NestedTypeTestModel+Schema.swift | 9 +- .../Models/Scalar/NestedTypeTestModel.swift | 3 +- .../Models/Scalar/Scalar+Equatable.swift | 24 ++-- .../Scalar/ScalarContainer+Schema.swift | 9 +- .../Models/Scalar/ScalarContainer.swift | 3 +- .../Models/ScenarioATest6Post+Schema.swift | 9 +- .../Models/ScenarioATest6Post.swift | 3 +- .../Models/TeamProject/Project+Schema.swift | 9 +- .../Models/TeamProject/Project.swift | 3 +- .../Models/TeamProject/Team+Schema.swift | 9 +- .../Models/TeamProject/Team.swift | 3 +- .../TransformerV2/1V2/Project1V2+Schema.swift | 9 +- .../Models/TransformerV2/1V2/Project1V2.swift | 8 +- .../TransformerV2/1V2/Team1V2+Schema.swift | 9 +- .../Models/TransformerV2/1V2/Team1V2.swift | 8 +- .../TransformerV2/2V2/Project2V2+Schema.swift | 9 +- .../Models/TransformerV2/2V2/Project2V2.swift | 8 +- .../TransformerV2/2V2/Team2V2+Schema.swift | 9 +- .../Models/TransformerV2/2V2/Team2V2.swift | 8 +- .../TransformerV2/3V2/Comment3V2+Schema.swift | 9 +- .../Models/TransformerV2/3V2/Comment3V2.swift | 8 +- .../TransformerV2/3V2/Post3V2+Schema.swift | 9 +- .../Models/TransformerV2/3V2/Post3V2.swift | 8 +- .../3aV2/Comment3aV2+Schema.swift | 9 +- .../TransformerV2/3aV2/Comment3aV2.swift | 8 +- .../TransformerV2/3aV2/Post3aV2+Schema.swift | 9 +- .../Models/TransformerV2/3aV2/Post3aV2.swift | 8 +- .../TransformerV2/4V2/Comment4V2+Schema.swift | 9 +- .../Models/TransformerV2/4V2/Comment4V2.swift | 8 +- .../TransformerV2/4V2/Post4V2+Schema.swift | 9 +- .../Models/TransformerV2/4V2/Post4V2.swift | 8 +- .../4aV2/Project4aV2+Schema.swift | 9 +- .../TransformerV2/4aV2/Project4aV2.swift | 8 +- .../TransformerV2/4aV2/Team4aV2+Schema.swift | 9 +- .../Models/TransformerV2/4aV2/Team4aV2.swift | 8 +- .../4bV2/Project4bV2+Schema.swift | 9 +- .../TransformerV2/4bV2/Project4bV2.swift | 8 +- .../TransformerV2/4bV2/Team4bV2+Schema.swift | 9 +- .../Models/TransformerV2/4bV2/Team4bV2.swift | 8 +- .../TransformerV2/5V2/Post5V2+Schema.swift | 9 +- .../Models/TransformerV2/5V2/Post5V2.swift | 8 +- .../5V2/PostEditor5V2+Schema.swift | 9 +- .../TransformerV2/5V2/PostEditor5V2.swift | 8 +- .../TransformerV2/5V2/User5V2+Schema.swift | 9 +- .../Models/TransformerV2/5V2/User5V2.swift | 8 +- .../TransformerV2/6V2/Blog6V2+Schema.swift | 9 +- .../Models/TransformerV2/6V2/Blog6V2.swift | 8 +- .../TransformerV2/6V2/Comment6V2+Schema.swift | 9 +- .../Models/TransformerV2/6V2/Comment6V2.swift | 8 +- .../TransformerV2/6V2/Post6V2+Schema.swift | 9 +- .../Models/TransformerV2/6V2/Post6V2.swift | 8 +- .../TransformerV2/7V2/Blog7V2+Schema.swift | 9 +- .../Models/TransformerV2/7V2/Blog7V2.swift | 8 +- .../TransformerV2/7V2/Comment7V2+Schema.swift | 9 +- .../Models/TransformerV2/7V2/Comment7V2.swift | 8 +- .../TransformerV2/7V2/Post7V2+Schema.swift | 9 +- .../Models/TransformerV2/7V2/Post7V2.swift | 8 +- .../8V2/Attendee8V2+Schema.swift | 9 +- .../TransformerV2/8V2/Attendee8V2.swift | 8 +- .../TransformerV2/8V2/Meeting8V2+Schema.swift | 9 +- .../Models/TransformerV2/8V2/Meeting8V2.swift | 8 +- .../8V2/Registration8V2+Schema.swift | 9 +- .../TransformerV2/8V2/Registration8V2.swift | 8 +- ...tomerMultipleSecondaryIndexV2+Schema.swift | 9 +- .../CustomerMultipleSecondaryIndexV2.swift | 8 +- .../CustomerSecondaryIndexV2+Schema.swift | 9 +- .../CustomerSecondaryIndexV2.swift | 8 +- ...ustomerWithMultipleFieldsinPK+Schema.swift | 9 +- .../CustomerWithMultipleFieldsinPK.swift | 8 +- .../OptionalAssociations/Blog8+Schema.swift | 9 +- .../OptionalAssociations/Blog8.swift | 8 +- .../Comment8+Schema.swift | 9 +- .../OptionalAssociations/Comment8.swift | 8 +- .../MyCustomModel8+Schema.swift | 9 +- .../MyNestedModel8+Schema.swift | 9 +- .../OptionalAssociations/Post8+Schema.swift | 9 +- .../OptionalAssociations/Post8.swift | 8 +- .../SchemaDrift/SchemaDrift+Schema.swift | 9 +- .../SchemaDrift/SchemaDrift.swift | 8 +- .../TodoCustomTimestampV2+Schema.swift | 9 +- .../TransformerV2/TodoCustomTimestampV2.swift | 8 +- .../TodoWithDefaultValueV2+Schema.swift | 9 +- .../TodoWithDefaultValueV2.swift | 8 +- AmplifyTestCommon/Models/User+Schema.swift | 19 +-- AmplifyTestCommon/Models/User.swift | 3 +- .../Models/UserFollowers+Schema.swift | 17 +-- AmplifyTestCommon/Models/UserFollowers.swift | 3 +- .../Models/UserFollowing+Schema.swift | 17 +-- AmplifyTestCommon/Models/UserFollowing.swift | 3 +- .../SharedTestCasesPostComment4V2.swift | 128 ++++++++++-------- AmplifyTestCommon/TestCommonConstants.swift | 1 + .../API/APICategoryClientGraphQLTests.swift | 2 +- .../API/APICategoryConfigurationTests.swift | 11 +- .../API/NondeterminsticOperationTests.swift | 1 - .../API/RetryableGraphQLOperationTests.swift | 2 +- .../AnalyticsCategoryClientAPITests.swift | 2 +- .../AnalyticsCategoryConfigurationTests.swift | 9 +- .../Auth/AuthCategoryConfigurationTests.swift | 11 +- .../DataStoreCategoryConfigurationTests.swift | 11 +- .../DataStore/JSONValueHolderTest.swift | 5 +- .../ArrayLiteralListProviderTests.swift | 6 +- .../DataStore/Model/LazyReferenceTests.swift | 34 ++--- .../DataStore/Model/ListPaginationTests.swift | 12 +- .../DataStore/Model/ListTests.swift | 33 ++--- .../DataStore/ModelIdentifierTests.swift | 2 +- .../DataStore/ModelPrimaryKeyTests.swift | 6 +- .../DataStore/ModelRegistryTests.swift | 2 +- .../Geo/GeoCategoryConfigurationTests.swift | 9 +- .../Hub/AmplifyOperationHubTests.swift | 27 ++-- .../DefaultHubPluginConcurrencyTests.swift | 5 +- .../DefaultHubPluginCustomChannelTests.swift | 3 +- .../DefaultHubPluginTests.swift | 14 +- .../Hub/HubCategoryConfigurationTests.swift | 6 +- .../CategoryTests/Hub/HubCombineTests.swift | 2 +- .../CategoryTests/Hub/HubListenerTests.swift | 2 +- ...LoggingPluginAmplifyVersionableTests.swift | 2 +- .../LoggingCategoryClientAPITests.swift | 12 +- .../LoggingCategoryConfigurationTests.swift | 6 +- .../NotificationsCategoryTests.swift | 4 +- ...hNotificationsCategoryClientAPITests.swift | 8 +- ...ificationsCategoryConfigurationTests.swift | 17 ++- .../ModelsTest/LanguageTypeTest.swift | 2 +- ...redictionsCategoryConfigurationTests.swift | 3 +- .../StorageCategoryConfigurationTests.swift | 9 +- .../CoreTests/AmplifyAsyncSequenceTests.swift | 12 +- ...rocessReportingOperationChainedTests.swift | 4 +- ...rocessReportingOperationCombineTests.swift | 2 +- .../AmplifyOperationCombineTests.swift | 6 +- .../CoreTests/AmplifyPublisherTests.swift | 60 ++++---- .../CoreTests/AmplifyTaskQueueTests.swift | 12 +- AmplifyTests/CoreTests/AmplifyTaskTests.swift | 12 +- .../CoreTests/AnyEncodableTests.swift | 2 +- AmplifyTests/CoreTests/AtomicValueTests.swift | 2 +- .../CoreTests/ConfigurationTests.swift | 6 +- .../CoreTests/FoundationUtilsTests.swift | 12 +- .../CoreTests/InternalTaskTests.swift | 6 +- .../CoreTests/JSONValue+KeyPathTests.swift | 2 +- .../CoreTests/JSONValue+SubscriptTests.swift | 2 +- AmplifyTests/CoreTests/JSONValueTests.swift | 6 +- .../CoreTests/Model+CodableTests.swift | 2 +- ...NotificationListeningAnalyticsPlugin.swift | 4 +- .../CoreTests/Operations/FastOperation.swift | 6 +- .../CoreTests/Operations/LongOperation.swift | 9 +- .../CoreTests/Optional+ExtentionTests.swift | 4 +- .../CoreTests/Tasks/InternalTasks.swift | 18 +-- AmplifyTests/CoreTests/TreeTests.swift | 2 +- .../Sources/AmplifyXcode/CLI.swift | 4 +- .../Sources/AmplifyXcode/CLICommand.swift | 6 +- .../CLICommandGenerateJSONSchema.swift | 2 +- .../AmplifyXcode/CLICommandImportConfig.swift | 4 +- .../AmplifyXcode/CLICommandImportModels.swift | 4 +- .../AmplifyXcode/CLICommandReportable.swift | 2 +- .../Support/ArgumentParser+CLICommand.swift | 2 +- .../Commands/AmplifyCommandError.swift | 4 +- .../Commands/CommandExecutable.swift | 5 +- .../Commands/CommandImportConfig.swift | 9 +- .../Commands/CommandImportModels.swift | 9 +- .../Environment/CommandEnvironment.swift | 27 ++-- .../FileManager+AmplifyFileManager.swift | 2 +- .../Support/FileManager+Utils.swift | 6 +- .../Support/XcodeProj+Helpers.swift | 5 +- .../Support/XcodeProject.swift | 10 +- .../CommandImportModelsTasksTests.swift | 6 +- .../Mocks/MockAmplifyCommandEnvironment.swift | 3 +- .../Mocks/MockAmplifyFileManager.swift | 2 +- .../AmplifyXcodeTests/AmplifyXcodeTests.swift | 2 +- .../MyAmplifyApp/MyAmplifyAppApp.swift | 2 +- 306 files changed, 1572 insertions(+), 1184 deletions(-) diff --git a/AmplifyTestApp/AppDelegate.swift b/AmplifyTestApp/AppDelegate.swift index 900a5a72a7..b5666b70b4 100644 --- a/AmplifyTestApp/AppDelegate.swift +++ b/AmplifyTestApp/AppDelegate.swift @@ -7,7 +7,7 @@ import UIKit -@UIApplicationMain +@main class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? diff --git a/AmplifyTestCommon/Helpers/AmplifyAssertions.swift b/AmplifyTestCommon/Helpers/AmplifyAssertions.swift index 139e404fe9..b98e763c92 100644 --- a/AmplifyTestCommon/Helpers/AmplifyAssertions.swift +++ b/AmplifyTestCommon/Helpers/AmplifyAssertions.swift @@ -12,7 +12,8 @@ import XCTest public func XCTAssertThrowFatalError(_ expression: @escaping () -> Void, file: StaticString = #file, - line: UInt = #line) throws { + line: UInt = #line) throws +{ #if (os(iOS) || os(macOS)) && (arch(arm64) || arch(x86_64)) var reached = false let exception = catchBadInstruction { @@ -28,7 +29,8 @@ public func XCTAssertThrowFatalError(_ expression: @escaping () -> Void, public func XCTAssertNoThrowFatalError(_ expression: @escaping () -> Void, file: StaticString = #file, - line: UInt = #line) throws { + 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/AuthSignInHelper.swift b/AmplifyTestCommon/Helpers/AuthSignInHelper.swift index 98e6d9556a..d091aa412a 100644 --- a/AmplifyTestCommon/Helpers/AuthSignInHelper.swift +++ b/AmplifyTestCommon/Helpers/AuthSignInHelper.swift @@ -9,7 +9,7 @@ import Amplify public typealias CompletionType = (Bool, AuthError?) -> Void -public struct AuthSignInHelper { +public enum AuthSignInHelper { public static func signUpUser(username: String, password: String, email: String) async throws -> AuthSignUpResult { let options = AuthSignUpRequest.Options(userAttributes: [AuthUserAttribute(.email, value: email)]) diff --git a/AmplifyTestCommon/Helpers/HubListenerTestUtilities.swift b/AmplifyTestCommon/Helpers/HubListenerTestUtilities.swift index 60f0a4c311..744fd9ff7e 100644 --- a/AmplifyTestCommon/Helpers/HubListenerTestUtilities.swift +++ b/AmplifyTestCommon/Helpers/HubListenerTestUtilities.swift @@ -8,7 +8,7 @@ import Amplify import Foundation -struct HubListenerTestUtilities { +enum HubListenerTestUtilities { /// Blocks current thread until the listener with `token` is attached to the plugin. Returns `true` if the listener /// becomes present before the `timeout` expires, `false` otherwise. @@ -21,7 +21,8 @@ struct HubListenerTestUtilities { plugin: HubCategoryPlugin? = nil, timeout: TimeInterval, file: StaticString = #file, - line: UInt = #line) async throws -> Bool { + line: UInt = #line) async throws -> Bool + { let plugin = try plugin ?? Amplify.Hub.getPlugin(for: AWSHubPlugin.key) diff --git a/AmplifyTestCommon/Helpers/TypeRegistry.swift b/AmplifyTestCommon/Helpers/TypeRegistry.swift index b136759ab6..caa8fef882 100644 --- a/AmplifyTestCommon/Helpers/TypeRegistry.swift +++ b/AmplifyTestCommon/Helpers/TypeRegistry.swift @@ -29,7 +29,7 @@ class TypeRegistry { hasher.combine(ObjectIdentifier(type)) } - static func ==(lhs: TypeRegistry.Key, rhs: TypeRegistry.Key) -> Bool { + static func == (lhs: TypeRegistry.Key, rhs: TypeRegistry.Key) -> Bool { lhs.type == rhs.type } } diff --git a/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift index d1336f66a1..01f6de2bfb 100644 --- a/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift @@ -13,7 +13,8 @@ import Foundation class MockAPICategoryPlugin: MessageReporter, APICategoryPlugin, APICategoryReachabilityBehavior, - APICategoryGraphQLBehavior { + APICategoryGraphQLBehavior +{ var authProviderFactory: APIAuthProviderFactory? @@ -91,11 +92,11 @@ class MockAPICategoryPlugin: MessageReporter, variables: request.variables, responseType: request.responseType, options: requestOptions) - + let taskRunner = MockAWSGraphQLSubscriptionTaskRunner(request: request) return taskRunner.sequence } - + public func reachabilityPublisher(for apiName: String?) -> AnyPublisher? { reachabilityPublisher() } @@ -121,7 +122,7 @@ class MockAPICategoryPlugin: MessageReporter, let operation = MockAPIOperation(request: operationRequest) return operation } - + func get(request: RESTRequest) async throws -> RESTTask.Success { notify("get") return Data() @@ -138,7 +139,7 @@ class MockAPICategoryPlugin: MessageReporter, let operation = MockAPIOperation(request: request) return operation } - + func put(request: RESTRequest) async throws -> RESTTask.Success { notify("put") let request = RESTOperationRequest(apiName: request.apiName, @@ -176,7 +177,7 @@ class MockAPICategoryPlugin: MessageReporter, let taskAdapter = AmplifyOperationTaskAdapter(operation: operation) return try await taskAdapter.value } - + func delete(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { notify("delete") let request = RESTOperationRequest(apiName: request.apiName, @@ -201,7 +202,7 @@ class MockAPICategoryPlugin: MessageReporter, let taskAdapter = AmplifyOperationTaskAdapter(operation: operation) return try await taskAdapter.value } - + func patch(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { notify("patch") let request = RESTOperationRequest(apiName: request.apiName, @@ -213,7 +214,7 @@ class MockAPICategoryPlugin: MessageReporter, let operation = MockAPIOperation(request: request) return operation } - + func patch(request: RESTRequest) async throws -> RESTTask.Success { notify("patch") let request = RESTOperationRequest(apiName: request.apiName, @@ -238,7 +239,7 @@ class MockAPICategoryPlugin: MessageReporter, let operation = MockAPIOperation(request: request) return operation } - + func head(request: RESTRequest) async throws -> RESTTask.Success { notify("head") let request = RESTOperationRequest(apiName: request.apiName, @@ -251,7 +252,7 @@ class MockAPICategoryPlugin: MessageReporter, let taskAdapter = AmplifyOperationTaskAdapter(operation: operation) return try await taskAdapter.value } - + func add(interceptor: URLRequestInterceptor, for apiName: String) { notify("addInterceptor") @@ -260,7 +261,7 @@ class MockAPICategoryPlugin: MessageReporter, // MARK: - APICategoryAuthProviderFactoryBehavior func apiAuthProviderFactory() -> APIAuthProviderFactory { - if let authProviderFactory = authProviderFactory { + if let authProviderFactory { return authProviderFactory } else { return APIAuthProviderFactory() @@ -282,7 +283,8 @@ class MockGraphQLOperation: GraphQLOperation { } init(request: Request, - responseType: R.Type) { + responseType: R.Type) + { super.init(categoryType: .api, eventName: HubPayload.EventName.API.mutate, request: request) @@ -298,7 +300,8 @@ class MockSubscriptionGraphQLOperation: GraphQLSubscriptionOperati } init(request: Request, - responseType: R.Type) { + responseType: R.Type) + { super.init(categoryType: .api, eventName: HubPayload.EventName.API.subscribe, request: request) @@ -324,7 +327,8 @@ class MockAPIAuthProviderFactory: APIAuthProviderFactory { let functionProvider: AmplifyFunctionAuthProvider? init(oidcProvider: AmplifyOIDCAuthProvider? = nil, - functionProvider: AmplifyFunctionAuthProvider? = nil) { + functionProvider: AmplifyFunctionAuthProvider? = nil) + { self.oidcProvider = oidcProvider self.functionProvider = functionProvider } @@ -340,7 +344,7 @@ class MockAPIAuthProviderFactory: APIAuthProviderFactory { class MockOIDCAuthProvider: AmplifyOIDCAuthProvider { var result: Result? - + func getLatestAuthToken() async throws -> String { if case let .success(token) = result { return token @@ -352,7 +356,7 @@ class MockOIDCAuthProvider: AmplifyOIDCAuthProvider { class MockFunctionAuthProvider: AmplifyFunctionAuthProvider { var result: Result? - + func getLatestAuthToken() async throws -> String { if case let .success(token) = result { return token @@ -363,17 +367,17 @@ class MockFunctionAuthProvider: AmplifyFunctionAuthProvider { } class MockAWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, InternalTaskAsyncThrowingSequence, InternalTaskThrowingChannel { - + public typealias Request = GraphQLOperationRequest public typealias InProcess = GraphQLSubscriptionEvent public var request: GraphQLOperationRequest public var context = InternalTaskAsyncThrowingSequenceContext>() func run() async throws { - + } - + init(request: GraphQLOperationRequest) { self.request = request } - + } diff --git a/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift index 94e44aa795..9223b7b566 100644 --- a/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { @@ -16,7 +16,8 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { func signIn(username: String, password: String, - options: AuthSignInRequest.Options?) async throws -> AuthSignInResult { + options: AuthSignInRequest.Options?) async throws -> AuthSignInResult + { fatalError() } @@ -26,7 +27,8 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { public func confirmSignUp(for username: String, confirmationCode: String, - options: AuthConfirmSignUpRequest.Options? = nil) async throws -> AuthSignUpResult { + options: AuthConfirmSignUpRequest.Options? = nil) async throws -> AuthSignUpResult + { fatalError() } @@ -36,25 +38,29 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { public func signIn(username: String? = nil, password: String? = nil, - options: AuthSignInRequest.Options? = nil) async throws -> AuthSignInResult { + 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 { + options: AuthWebUISignInRequest.Options? = nil) async throws -> AuthSignInResult + { fatalError() } public func signInWithWebUI(for authProvider: AuthProvider, presentationAnchor: AuthUIPresentationAnchor? = nil, - options: AuthWebUISignInRequest.Options? = nil) async throws -> AuthSignInResult { + options: AuthWebUISignInRequest.Options? = nil) async throws -> AuthSignInResult + { fatalError() } #endif public func confirmSignIn(challengeResponse: String, - options: AuthConfirmSignInRequest.Options? = nil) async throws -> AuthSignInResult { + options: AuthConfirmSignInRequest.Options? = nil) async throws -> AuthSignInResult + { fatalError() } @@ -77,7 +83,8 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { public func confirmResetPassword(for username: String, with newPassword: String, confirmationCode: String, - options: AuthConfirmResetPasswordRequest.Options? = nil) async throws { + options: AuthConfirmResetPasswordRequest.Options? = nil) async throws + { fatalError() } @@ -94,7 +101,8 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { } public func resendConfirmationCode(forUserAttributeKey userAttributeKey: AuthUserAttributeKey, options: AuthAttributeResendConfirmationCodeRequest.Options? = nil) - async throws -> AuthCodeDeliveryDetails { + async throws -> AuthCodeDeliveryDetails + { fatalError() } @@ -118,13 +126,15 @@ class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { public func confirm(userAttribute: AuthUserAttributeKey, confirmationCode: String, - options: AuthConfirmUserAttributeRequest.Options? = nil) async throws { + options: AuthConfirmUserAttributeRequest.Options? = nil) async throws + { fatalError() } public func update(oldPassword: String, to newPassword: String, - options: AuthChangePasswordRequest.Options? = nil) async throws { + options: AuthChangePasswordRequest.Options? = nil) async throws + { notify("changePassword") } diff --git a/AmplifyTestCommon/Mocks/MockCredentialsProvider.swift b/AmplifyTestCommon/Mocks/MockCredentialsProvider.swift index 5b4f232074..8b10f8d91c 100644 --- a/AmplifyTestCommon/Mocks/MockCredentialsProvider.swift +++ b/AmplifyTestCommon/Mocks/MockCredentialsProvider.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import AWSPluginsCore import AWSClientRuntime +import AWSPluginsCore import Foundation class MockCredentialsProvider: AWSClientRuntime.CredentialsProviding { @@ -14,7 +14,7 @@ class MockCredentialsProvider: AWSClientRuntime.CredentialsProviding { return AWSCredentials( accessKey: "accessKey", secret: "secret", - expirationTimeout: Date().addingTimeInterval(1000) + expirationTimeout: Date().addingTimeInterval(1_000) ) } } diff --git a/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift index 5ba46da457..191cad875c 100644 --- a/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift @@ -26,28 +26,32 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { func save(_ model: M, where condition: QueryPredicate? = nil, - completion: @escaping (DataStoreResult) -> Void) { + completion: @escaping (DataStoreResult) -> Void) + { notify("save") if let responder = responders[.saveModelListener] as? SaveModelResponder { Task { if let callback = await responder.callback((model: model, - where: condition)) { + where: condition)) + { completion(callback) } } } } - + func save(_ model: M, - where condition: QueryPredicate? = nil) async throws -> M { + where condition: QueryPredicate? = nil) async throws -> M + { notify("save") return model } func query(_ modelType: M.Type, byId id: String, - completion: @escaping (DataStoreResult) -> Void) { + completion: @escaping (DataStoreResult) -> Void) + { notify("queryById") if let responder = responders[.queryByIdListener] as? QueryByIdResponder { @@ -58,9 +62,10 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } } - + func query(_ modelType: M.Type, - byId id: String) async throws -> M? { + byId id: String) async throws -> M? + { notify("queryById") return nil } @@ -68,7 +73,8 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { func query(_ modelType: M.Type, byIdentifier id: String, completion: @escaping (DataStoreResult) -> Void) where M: ModelIdentifiable, - M.IdentifierFormat == ModelIdentifierFormat.Default { + M.IdentifierFormat == ModelIdentifierFormat.Default + { notify("queryByIdentifier") if let responder = responders[.queryByIdListener] as? QueryByIdResponder { @@ -79,10 +85,11 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } } - + func query(_ modelType: M.Type, byIdentifier id: String) async throws -> M? where M: ModelIdentifiable, - M.IdentifierFormat == ModelIdentifierFormat.Default { + M.IdentifierFormat == ModelIdentifierFormat.Default + { notify("queryByIdentifier") return nil } @@ -91,7 +98,8 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { where predicate: QueryPredicate?, sort sortInput: QuerySortInput?, paginate paginationInput: QueryPaginationInput?, - completion: @escaping (DataStoreResult<[M]>) -> Void) { + completion: @escaping (DataStoreResult<[M]>) -> Void) + { notify("queryByPredicate") if let responder = responders[.queryModelsListener] as? QueryModelsResponder { @@ -99,24 +107,27 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let result = await responder.callback((modelType: modelType, where: predicate, sort: sortInput, - paginate: paginationInput)) { + paginate: paginationInput)) + { completion(result) } } } } - + func query(_ modelType: M.Type, where predicate: QueryPredicate?, sort sortInput: QuerySortInput?, - paginate paginationInput: QueryPaginationInput?) async throws -> [M] { + 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)) { + paginate: paginationInput)) + { switch result { case .success(let models): return models @@ -125,13 +136,14 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } } - + return [] } func query(_ modelType: M.Type, byIdentifier id: ModelIdentifier, - completion: @escaping (DataStoreResult) -> Void) where M: Model, M: ModelIdentifiable { + completion: @escaping (DataStoreResult) -> Void) where M: Model, M: ModelIdentifiable + { notify("queryWithIdentifier") if let responder = responders[.queryByIdListener] as? QueryByIdResponder { @@ -142,10 +154,11 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } } - + func query(_ modelType: M.Type, byIdentifier id: ModelIdentifier) async throws -> M? - where M: Model, M: ModelIdentifiable { + where M: Model, M: ModelIdentifiable + { notify("queryWithIdentifier") return nil } @@ -153,7 +166,8 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { func delete(_ modelType: M.Type, withId id: String, where predicate: QueryPredicate? = nil, - completion: @escaping (DataStoreResult) -> Void) { + completion: @escaping (DataStoreResult) -> Void) + { notify("deleteById") if let responder = responders[.deleteByIdListener] as? DeleteByIdResponder { @@ -164,10 +178,11 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } } - - func delete(_ modelType: M.Type, + + func delete(_ modelType: (some Model).Type, withId id: String, - where predicate: QueryPredicate? = nil) async throws { + where predicate: QueryPredicate? = nil) async throws + { notify("deleteById") } @@ -175,7 +190,8 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { withIdentifier id: String, where predicate: QueryPredicate? = nil, completion: @escaping (DataStoreResult) -> Void) where M: ModelIdentifiable, - M.IdentifierFormat == ModelIdentifierFormat.Default { + M.IdentifierFormat == ModelIdentifierFormat.Default + { notify("deleteByIdentifier") if let responder = responders[.deleteByIdListener] as? DeleteByIdResponder { @@ -190,14 +206,16 @@ 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 { + 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 { + completion: @escaping DataStoreCallback) where M: Model, M: ModelIdentifiable + { notify("deleteByIdentifier") if let responder = responders[.deleteByIdListener] as? DeleteByIdResponder { @@ -211,13 +229,15 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { func delete(_ modelType: M.Type, withIdentifier id: ModelIdentifier, - where predicate: QueryPredicate?) async throws where M: Model, M: ModelIdentifiable { + where predicate: QueryPredicate?) async throws where M: Model, M: ModelIdentifiable + { notify("deleteByIdentifier") } - + func delete(_ modelType: M.Type, where predicate: QueryPredicate, - completion: @escaping (DataStoreResult) -> Void) { + completion: @escaping (DataStoreResult) -> Void) + { notify("deleteModelTypeByPredicate") if let responder = responders[.deleteModelTypeListener] as? DeleteModelTypeResponder { @@ -228,29 +248,33 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } } - - func delete(_ modelType: M.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) { + completion: @escaping DataStoreCallback) + { notify("deleteByPredicate") if let responder = responders[.deleteModelListener] as? DeleteModelResponder { Task { if let callback = await responder.callback((model: model, - where: predicate)) { + where: predicate)) + { completion(callback) } } } } - - func delete(_ model: M, - where predicate: QueryPredicate? = nil) async throws { + + func delete(_ model: some Model, + where predicate: QueryPredicate? = nil) async throws + { notify("deleteByPredicate") } @@ -265,7 +289,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } } - + func clear() async throws { notify("clear") } @@ -281,7 +305,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { } } } - + func start() async throws { notify("start") } @@ -301,8 +325,8 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { func stop() async throws { notify("stop") } - - func publisher(for modelType: M.Type) + + func publisher(for modelType: (some Model).Type) -> AnyPublisher { let mutationEvent = MutationEvent(id: "testevent", modelId: "123", @@ -314,10 +338,10 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { return Result.Publisher(mutationEvent).eraseToAnyPublisher() } - func observe(_ modelType: M.Type) -> AmplifyAsyncThrowingSequence { + func observe(_ modelType: (some Model).Type) -> AmplifyAsyncThrowingSequence { return AmplifyAsyncThrowingSequence(parent: nil) } - + public func observeQuery(for modelType: M.Type, where predicate: QueryPredicate? = nil, sort sortInput: QuerySortInput? = nil) @@ -326,11 +350,12 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { let snapshot = DataStoreQuerySnapshot(items: [], isSynced: false) return Result.Publisher(snapshot).eraseToAnyPublisher() } - + func observeQuery(for modelType: M.Type, where predicate: QueryPredicate?, - sort sortInput: QuerySortInput?) -> AmplifyAsyncThrowingSequence> { - + sort sortInput: QuerySortInput?) -> AmplifyAsyncThrowingSequence> + { + let request = ObserveQueryRequest(options: []) let taskRunner = MockObserveQueryTaskRunner(request: request) return taskRunner.sequence @@ -346,13 +371,13 @@ class MockSecondDataStoreCategoryPlugin: MockDataStoreCategoryPlugin { class ObserveQueryRequest: AmplifyOperationRequest { var options: Any - + typealias Options = Any - + init(options: Any) { self.options = options } - + } class MockObserveQueryTaskRunner: InternalTaskRunner, InternalTaskAsyncThrowingSequence, InternalTaskThrowingChannel { diff --git a/AmplifyTestCommon/Mocks/MockHubCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockHubCategoryPlugin.swift index 4c5abd37a2..fc66a90fb6 100644 --- a/AmplifyTestCommon/Mocks/MockHubCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockHubCategoryPlugin.swift @@ -28,14 +28,16 @@ class MockHubCategoryPlugin: MessageReporter, HubCategoryPlugin { func listen(to channel: HubChannel, eventName: HubPayloadEventName, - listener: @escaping HubListener) -> UnsubscribeToken { + listener: @escaping HubListener) -> UnsubscribeToken + { notify("listenEventName") return UnsubscribeToken(channel: channel, id: UUID()) } func listen(to channel: HubChannel, isIncluded filter: HubFilter?, - listener: @escaping HubListener) -> UnsubscribeToken { + listener: @escaping HubListener) -> UnsubscribeToken + { notify("listen") return UnsubscribeToken(channel: channel, id: UUID()) } diff --git a/AmplifyTestCommon/Mocks/MockLoggingCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockLoggingCategoryPlugin.swift index ca51dc55c8..cd5ebcea1d 100644 --- a/AmplifyTestCommon/Mocks/MockLoggingCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockLoggingCategoryPlugin.swift @@ -17,7 +17,7 @@ class MockLoggingCategoryPlugin: MessageReporter, LoggingCategoryPlugin, Logger func logger(forCategory category: String) -> Logger { self } - + func logger(forNamespace namespace: String) -> Logger { self } @@ -25,15 +25,15 @@ class MockLoggingCategoryPlugin: MessageReporter, LoggingCategoryPlugin, Logger func logger(forCategory category: String, logLevel: LogLevel) -> Logger { self } - + func logger(forCategory category: String, forNamespace namespace: String) -> Logger { self } - + func enable() { notify("enable") } - + func disable() { notify("disable") } diff --git a/AmplifyTestCommon/Mocks/MockPredictionsCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockPredictionsCategoryPlugin.swift index e226dbddab..b33b97ccb3 100644 --- a/AmplifyTestCommon/Mocks/MockPredictionsCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockPredictionsCategoryPlugin.swift @@ -13,7 +13,7 @@ class MockPredictionsCategoryPlugin: MessageReporter, PredictionsCategoryPlugin fatalError() } - func convert(_ request: Predictions.Convert.Request, options: Options?) async throws -> Output { + func convert(_ request: Predictions.Convert.Request, options: Options?) async throws -> Output { fatalError() } diff --git a/AmplifyTestCommon/Mocks/MockPushNotificationsCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockPushNotificationsCategoryPlugin.swift index d545d1d129..b080ce92c6 100644 --- a/AmplifyTestCommon/Mocks/MockPushNotificationsCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockPushNotificationsCategoryPlugin.swift @@ -13,27 +13,27 @@ class MockPushNotificationsCategoryPlugin: MessageReporter, PushNotificationsCat var key: String { "MockPushNotificationsCategoryPlugin" } - + func configure(using configuration: Any?) throws { notify() } - + func reset() async { notify() } - + func identifyUser(userId: String, userProfile: AmplifyUserProfile?) { notify("identifyUser(userId:\(userId))") } - + func registerDevice(apnsToken: Data) { notify("registerDevice(token:\(apnsToken))") } - + func recordNotificationReceived(_ userInfo: Notifications.Push.UserInfo) { notify("recordNotificationReceived(userInfo:\(userInfo))") } - + #if !os(tvOS) func recordNotificationOpened(_ response: UNNotificationResponse) { notify("recordNotificationOpened(response:\(response))") diff --git a/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift index bc6255567f..353023c875 100644 --- a/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift @@ -12,7 +12,8 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { func getURL(key: String, options: StorageGetURLRequest.Options?, - resultListener: StorageGetURLOperation.ResultListener?) -> StorageGetURLOperation { + resultListener: StorageGetURLOperation.ResultListener?) -> StorageGetURLOperation + { notify("getURL") let options = options ?? StorageGetURLRequest.Options() let request = StorageGetURLRequest(key: key, options: options) @@ -68,7 +69,8 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { func remove(key: String, options: StorageRemoveRequest.Options?, - resultListener: StorageRemoveOperation.ResultListener?) -> StorageRemoveOperation { + resultListener: StorageRemoveOperation.ResultListener?) -> StorageRemoveOperation + { notify("remove") let options = options ?? StorageRemoveRequest.Options() let request = StorageRemoveRequest(key: key, options: options) @@ -76,7 +78,8 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { } func list(options: StorageListRequest.Options?, - resultListener: StorageListOperation.ResultListener?) -> StorageListOperation { + resultListener: StorageListOperation.ResultListener?) -> StorageListOperation + { notify("list") let options = options ?? StorageListRequest.Options() let request = StorageListRequest(options: options) @@ -99,7 +102,8 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { @discardableResult func getURL(key: String, - options: StorageGetURLOperation.Request.Options?) async throws -> URL { + options: StorageGetURLOperation.Request.Options?) async throws -> URL + { notify("getURL") let options = options ?? StorageGetURLRequest.Options() let request = StorageGetURLRequest(key: key, options: options) @@ -110,7 +114,8 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { @discardableResult func remove(key: String, - options: StorageRemoveRequest.Options? = nil) async throws -> String { + options: StorageRemoveRequest.Options? = nil) async throws -> String + { notify("remove") let options = options ?? StorageRemoveRequest.Options() let request = StorageRemoveRequest(key: key, options: options) @@ -121,7 +126,8 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { @discardableResult func downloadData(key: String, - options: StorageDownloadDataOperation.Request.Options? = nil) -> StorageDownloadDataTask { + options: StorageDownloadDataOperation.Request.Options? = nil) -> StorageDownloadDataTask + { notify("downloadData") let options = options ?? StorageDownloadDataRequest.Options() let request = StorageDownloadDataRequest(key: key, options: options) @@ -133,7 +139,8 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { @discardableResult func downloadFile(key: String, local: URL, - options: StorageDownloadFileOperation.Request.Options?) -> StorageDownloadFileTask { + options: StorageDownloadFileOperation.Request.Options?) -> StorageDownloadFileTask + { notify("downloadFile") let options = options ?? StorageDownloadFileRequest.Options() let request = StorageDownloadFileRequest(key: key, local: local, options: options) @@ -145,7 +152,8 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { @discardableResult func uploadData(key: String, data: Data, - options: StorageUploadDataOperation.Request.Options?) -> StorageUploadDataTask { + options: StorageUploadDataOperation.Request.Options?) -> StorageUploadDataTask + { notify("uploadData") let options = options ?? StorageUploadDataRequest.Options() let request = StorageUploadDataRequest(key: key, data: data, options: options) @@ -157,7 +165,8 @@ class MockStorageCategoryPlugin: MessageReporter, StorageCategoryPlugin { @discardableResult func uploadFile(key: String, local: URL, - options: StorageUploadFileOperation.Request.Options?) -> StorageUploadFileTask { + options: StorageUploadFileOperation.Request.Options?) -> StorageUploadFileTask + { notify("uploadFile") let options = options ?? StorageUploadFileRequest.Options() let request = StorageUploadFileRequest(key: key, local: local, options: options) @@ -251,7 +260,8 @@ class MockSecondStorageCategoryPlugin: MockStorageCategoryPlugin { } class MockStorageGetURLOperation: AmplifyOperation, - StorageGetURLOperation { + StorageGetURLOperation +{ override func pause() { } @@ -342,7 +352,8 @@ StorageError } class MockStorageRemoveOperation: AmplifyOperation, - StorageRemoveOperation { + StorageRemoveOperation +{ override func pause() { } @@ -357,7 +368,8 @@ class MockStorageRemoveOperation: AmplifyOperation, - StorageListOperation { + StorageListOperation +{ override func pause() { } diff --git a/AmplifyTestCommon/Models/AmplifyModels.swift b/AmplifyTestCommon/Models/AmplifyModels.swift index 2f95bb74f4..20d39f3f52 100644 --- a/AmplifyTestCommon/Models/AmplifyModels.swift +++ b/AmplifyTestCommon/Models/AmplifyModels.swift @@ -11,7 +11,7 @@ import Foundation // Contains the set of classes that conforms to the `Model` protocol. -final public class AmplifyModels: AmplifyModelRegistration { +public final class AmplifyModels: AmplifyModelRegistration { public let version: String public init(version: String = "46369a50a95486d76713fd33833fb782") { diff --git a/AmplifyTestCommon/Models/Article+Schema.swift b/AmplifyTestCommon/Models/Article+Schema.swift index 251a7dfe2c..d3e185ff6b 100644 --- a/AmplifyTestCommon/Models/Article+Schema.swift +++ b/AmplifyTestCommon/Models/Article+Schema.swift @@ -9,9 +9,9 @@ import Amplify import Foundation -extension Article { +public extension Article { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case content case createdAt @@ -19,10 +19,10 @@ extension Article { case authorNotes } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let article = Article.keys model.listPluralName = "Articles" diff --git a/AmplifyTestCommon/Models/Article.swift b/AmplifyTestCommon/Models/Article.swift index 5b1486510a..a3a258789a 100644 --- a/AmplifyTestCommon/Models/Article.swift +++ b/AmplifyTestCommon/Models/Article.swift @@ -20,7 +20,8 @@ public struct Article: Model { content: String, createdAt: Temporal.DateTime, owner: String?, - authorNotes: String?) { + authorNotes: String?) + { self.id = id self.content = content self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/Associations/Author+Schema.swift b/AmplifyTestCommon/Models/Associations/Author+Schema.swift index d9d5041436..64639ad027 100644 --- a/AmplifyTestCommon/Models/Associations/Author+Schema.swift +++ b/AmplifyTestCommon/Models/Associations/Author+Schema.swift @@ -8,20 +8,20 @@ import Amplify import Foundation -extension Author { +public extension Author { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case name case books } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let author = Author.keys model.fields( @@ -33,9 +33,9 @@ extension Author { ) } - public class Path : ModelPath {} + class Path: ModelPath {} - public static var rootPath: PropertyContainerPath? { Path() } + static var rootPath: PropertyContainerPath? { Path() } } diff --git a/AmplifyTestCommon/Models/Associations/Author.swift b/AmplifyTestCommon/Models/Associations/Author.swift index 61b68ea4d8..914499eda6 100644 --- a/AmplifyTestCommon/Models/Associations/Author.swift +++ b/AmplifyTestCommon/Models/Associations/Author.swift @@ -18,7 +18,8 @@ public struct Author: Model { public init(id: String = UUID().uuidString, name: String, - books: List = []) { + 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 e71488b030..a1dc8fcafb 100644 --- a/AmplifyTestCommon/Models/Associations/Book+Schema.swift +++ b/AmplifyTestCommon/Models/Associations/Book+Schema.swift @@ -8,20 +8,20 @@ import Amplify import Foundation -extension Book { +public extension Book { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case title case authors } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let book = Book.keys model.fields( @@ -33,9 +33,9 @@ extension Book { ) } - public class Path : ModelPath {} + class Path: ModelPath {} - public static var rootPath: PropertyContainerPath? { Path() } + static var rootPath: PropertyContainerPath? { Path() } } diff --git a/AmplifyTestCommon/Models/Associations/Book.swift b/AmplifyTestCommon/Models/Associations/Book.swift index 64de97c0ed..b64e099457 100644 --- a/AmplifyTestCommon/Models/Associations/Book.swift +++ b/AmplifyTestCommon/Models/Associations/Book.swift @@ -18,7 +18,8 @@ public struct Book: Model { public init(id: String = UUID().uuidString, title: String, - authors: List = []) { + 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 c6a22c9bcb..967f1069a5 100644 --- a/AmplifyTestCommon/Models/Associations/BookAuthor+Schema.swift +++ b/AmplifyTestCommon/Models/Associations/BookAuthor+Schema.swift @@ -8,20 +8,20 @@ import Amplify import Foundation -extension BookAuthor { +public extension BookAuthor { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case book case author } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let bookAuthor = BookAuthor.keys model.fields( @@ -35,9 +35,9 @@ extension BookAuthor { ) } - public class Path : ModelPath {} + class Path: ModelPath {} - public static var rootPath: PropertyContainerPath? { Path() } + static var rootPath: PropertyContainerPath? { Path() } } diff --git a/AmplifyTestCommon/Models/Associations/BookAuthor.swift b/AmplifyTestCommon/Models/Associations/BookAuthor.swift index 1c837b590c..02c7922595 100644 --- a/AmplifyTestCommon/Models/Associations/BookAuthor.swift +++ b/AmplifyTestCommon/Models/Associations/BookAuthor.swift @@ -20,7 +20,8 @@ public struct BookAuthor: Model { public init(id: String = UUID().uuidString, book: Book, - author: Author) { + 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 dc51cd80e0..ce187a77fc 100644 --- a/AmplifyTestCommon/Models/Associations/UserAccount+Schema.swift +++ b/AmplifyTestCommon/Models/Associations/UserAccount+Schema.swift @@ -8,19 +8,19 @@ import Amplify import Foundation -extension UserAccount { +public extension UserAccount { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case profile } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let account = UserAccount.keys model.fields( diff --git a/AmplifyTestCommon/Models/Associations/UserAccount.swift b/AmplifyTestCommon/Models/Associations/UserAccount.swift index 268b5f0fed..5229cb5331 100644 --- a/AmplifyTestCommon/Models/Associations/UserAccount.swift +++ b/AmplifyTestCommon/Models/Associations/UserAccount.swift @@ -21,7 +21,8 @@ public class UserAccount: Model { public var profile: UserProfile? public init(id: String = UUID().uuidString, - profile: UserProfile? = nil) { + 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 6b6eb355d7..3c24023562 100644 --- a/AmplifyTestCommon/Models/Associations/UserProfile+Schema.swift +++ b/AmplifyTestCommon/Models/Associations/UserProfile+Schema.swift @@ -8,19 +8,19 @@ import Amplify import Foundation -extension UserProfile { +public extension UserProfile { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case account } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let profile = UserProfile.keys model.fields( diff --git a/AmplifyTestCommon/Models/Associations/UserProfile.swift b/AmplifyTestCommon/Models/Associations/UserProfile.swift index 227d1c8da5..fa30f14840 100644 --- a/AmplifyTestCommon/Models/Associations/UserProfile.swift +++ b/AmplifyTestCommon/Models/Associations/UserProfile.swift @@ -21,7 +21,8 @@ public class UserProfile: Model { public var account: UserAccount public init(id: String = UUID().uuidString, - account: UserAccount) { + 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 d561583928..03fe1c4394 100644 --- a/AmplifyTestCommon/Models/Collection/1/Project1+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/1/Project1+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Project1 { +public extension Project1 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case team } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let project1 = Project1.keys model.listPluralName = "Project1s" diff --git a/AmplifyTestCommon/Models/Collection/1/Project1.swift b/AmplifyTestCommon/Models/Collection/1/Project1.swift index ab67718c80..760c68fa7d 100644 --- a/AmplifyTestCommon/Models/Collection/1/Project1.swift +++ b/AmplifyTestCommon/Models/Collection/1/Project1.swift @@ -16,7 +16,8 @@ public struct Project1: Model { 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 be252d9197..ffc1524b32 100644 --- a/AmplifyTestCommon/Models/Collection/1/Team1+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/1/Team1+Schema.swift @@ -9,17 +9,18 @@ import Amplify import Foundation -extension Team1 { +public extension Team1 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let team1 = Team1.keys model.listPluralName = "Team1s" diff --git a/AmplifyTestCommon/Models/Collection/1/Team1.swift b/AmplifyTestCommon/Models/Collection/1/Team1.swift index 4a6101a50c..35e80b301c 100644 --- a/AmplifyTestCommon/Models/Collection/1/Team1.swift +++ b/AmplifyTestCommon/Models/Collection/1/Team1.swift @@ -14,7 +14,8 @@ public struct Team1: Model { public var name: String public init(id: String = UUID().uuidString, - name: String) { + 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 7bd2fd74ce..f84a28fab3 100644 --- a/AmplifyTestCommon/Models/Collection/2/Project2+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/2/Project2+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension Project2 { +public extension Project2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case teamID case team } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let project2 = Project2.keys model.listPluralName = "Project2s" diff --git a/AmplifyTestCommon/Models/Collection/2/Project2.swift b/AmplifyTestCommon/Models/Collection/2/Project2.swift index a5307b612c..1646709631 100644 --- a/AmplifyTestCommon/Models/Collection/2/Project2.swift +++ b/AmplifyTestCommon/Models/Collection/2/Project2.swift @@ -18,7 +18,8 @@ public struct Project2: Model { 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 9c7424a94d..242b488781 100644 --- a/AmplifyTestCommon/Models/Collection/2/Team2+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/2/Team2+Schema.swift @@ -9,17 +9,18 @@ import Amplify import Foundation -extension Team2 { +public extension Team2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let team2 = Team2.keys model.listPluralName = "Team2s" diff --git a/AmplifyTestCommon/Models/Collection/2/Team2.swift b/AmplifyTestCommon/Models/Collection/2/Team2.swift index eece17c222..e02590b475 100644 --- a/AmplifyTestCommon/Models/Collection/2/Team2.swift +++ b/AmplifyTestCommon/Models/Collection/2/Team2.swift @@ -14,7 +14,8 @@ public struct Team2: Model { public var name: String public init(id: String = UUID().uuidString, - name: String) { + 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 03c4b0eb64..4568dbb0a5 100644 --- a/AmplifyTestCommon/Models/Collection/3/Comment3+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/3/Comment3+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Comment3 { +public extension Comment3 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case postID case content } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment3 = Comment3.keys model.listPluralName = "Comment3s" diff --git a/AmplifyTestCommon/Models/Collection/3/Comment3.swift b/AmplifyTestCommon/Models/Collection/3/Comment3.swift index f24badf993..b799be9229 100644 --- a/AmplifyTestCommon/Models/Collection/3/Comment3.swift +++ b/AmplifyTestCommon/Models/Collection/3/Comment3.swift @@ -16,7 +16,8 @@ public struct Comment3: Model { 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 9f828c7c44..0293e0dc69 100644 --- a/AmplifyTestCommon/Models/Collection/3/Post3+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/3/Post3+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Post3 { +public extension Post3 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case comments } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post3 = Post3.keys model.listPluralName = "Post3s" diff --git a/AmplifyTestCommon/Models/Collection/3/Post3.swift b/AmplifyTestCommon/Models/Collection/3/Post3.swift index 1302c5a233..3e5e2828b1 100644 --- a/AmplifyTestCommon/Models/Collection/3/Post3.swift +++ b/AmplifyTestCommon/Models/Collection/3/Post3.swift @@ -16,7 +16,8 @@ public struct Post3: Model { 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 16b6b2a416..d932301c73 100644 --- a/AmplifyTestCommon/Models/Collection/4/Comment4+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/4/Comment4+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Comment4 { +public extension Comment4 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case post } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment4 = Comment4.keys model.listPluralName = "Comment4s" diff --git a/AmplifyTestCommon/Models/Collection/4/Comment4.swift b/AmplifyTestCommon/Models/Collection/4/Comment4.swift index 7b7cd90df6..15e2ef6de7 100644 --- a/AmplifyTestCommon/Models/Collection/4/Comment4.swift +++ b/AmplifyTestCommon/Models/Collection/4/Comment4.swift @@ -12,28 +12,29 @@ import Foundation public struct Comment4: Model { public let id: String public var content: String - internal var _post: LazyReference + var _post: LazyReference public var post: Post4? { get async throws { try await _post.get() } } - + public init(id: String = UUID().uuidString, content: String, - post: Post4? = nil) { + post: Post4? = nil) + { self.id = id self.content = content self._post = LazyReference(post) } - + public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try values.decode(String.self, forKey: .content) - _post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) + self.id = try values.decode(String.self, forKey: .id) + self.content = try values.decode(String.self, forKey: .content) + self._post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) } - + public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) diff --git a/AmplifyTestCommon/Models/Collection/4/Post4+Schema.swift b/AmplifyTestCommon/Models/Collection/4/Post4+Schema.swift index 17144a90a0..4cfe72c1d9 100644 --- a/AmplifyTestCommon/Models/Collection/4/Post4+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/4/Post4+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Post4 { +public extension Post4 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case comments } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post4 = Post4.keys model.listPluralName = "Post4s" diff --git a/AmplifyTestCommon/Models/Collection/4/Post4.swift b/AmplifyTestCommon/Models/Collection/4/Post4.swift index 4764058a79..d1d66e8f4a 100644 --- a/AmplifyTestCommon/Models/Collection/4/Post4.swift +++ b/AmplifyTestCommon/Models/Collection/4/Post4.swift @@ -16,7 +16,8 @@ public struct Post4: Model { 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 3898f6addd..54069a26fd 100644 --- a/AmplifyTestCommon/Models/Collection/5/Post5+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/5/Post5+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Post5 { +public extension Post5 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case editors } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post5 = Post5.keys model.listPluralName = "Post5s" diff --git a/AmplifyTestCommon/Models/Collection/5/Post5.swift b/AmplifyTestCommon/Models/Collection/5/Post5.swift index 023c8eb0dc..97648c1653 100644 --- a/AmplifyTestCommon/Models/Collection/5/Post5.swift +++ b/AmplifyTestCommon/Models/Collection/5/Post5.swift @@ -16,7 +16,8 @@ public struct Post5: Model { 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 586429c143..cb0b07f565 100644 --- a/AmplifyTestCommon/Models/Collection/5/PostEditor5+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/5/PostEditor5+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension PostEditor5 { +public extension PostEditor5 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case post case editor } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let postEditor5 = PostEditor5.keys model.listPluralName = "PostEditor5s" diff --git a/AmplifyTestCommon/Models/Collection/5/PostEditor5.swift b/AmplifyTestCommon/Models/Collection/5/PostEditor5.swift index 24cad3a416..8988103eeb 100644 --- a/AmplifyTestCommon/Models/Collection/5/PostEditor5.swift +++ b/AmplifyTestCommon/Models/Collection/5/PostEditor5.swift @@ -16,7 +16,8 @@ public struct PostEditor5: Model { 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 cf467b9f55..d698f06731 100644 --- a/AmplifyTestCommon/Models/Collection/5/User5+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/5/User5+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension User5 { +public extension User5 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case username case posts } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let user5 = User5.keys model.listPluralName = "User5s" diff --git a/AmplifyTestCommon/Models/Collection/5/User5.swift b/AmplifyTestCommon/Models/Collection/5/User5.swift index 3fab8d8d27..02d3c1d018 100644 --- a/AmplifyTestCommon/Models/Collection/5/User5.swift +++ b/AmplifyTestCommon/Models/Collection/5/User5.swift @@ -16,7 +16,8 @@ public struct User5: Model { 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 fc6b58b600..1cb72abaaa 100644 --- a/AmplifyTestCommon/Models/Collection/6/Blog6+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/6/Blog6+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Blog6 { +public extension Blog6 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case posts } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let blog6 = Blog6.keys model.listPluralName = "Blog6s" diff --git a/AmplifyTestCommon/Models/Collection/6/Blog6.swift b/AmplifyTestCommon/Models/Collection/6/Blog6.swift index 9bc903c6d4..b337a69c23 100644 --- a/AmplifyTestCommon/Models/Collection/6/Blog6.swift +++ b/AmplifyTestCommon/Models/Collection/6/Blog6.swift @@ -16,7 +16,8 @@ public struct Blog6: Model { 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 3d180ac245..8eca92671b 100644 --- a/AmplifyTestCommon/Models/Collection/6/Comment6+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/6/Comment6+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Comment6 { +public extension Comment6 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case post case content } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment6 = Comment6.keys model.listPluralName = "Comment6s" diff --git a/AmplifyTestCommon/Models/Collection/6/Comment6.swift b/AmplifyTestCommon/Models/Collection/6/Comment6.swift index 061c288aa1..1d0b3e574e 100644 --- a/AmplifyTestCommon/Models/Collection/6/Comment6.swift +++ b/AmplifyTestCommon/Models/Collection/6/Comment6.swift @@ -16,7 +16,8 @@ public struct Comment6: Model { 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 e84aa85350..d5ccd4cbf7 100644 --- a/AmplifyTestCommon/Models/Collection/6/Post6+Schema.swift +++ b/AmplifyTestCommon/Models/Collection/6/Post6+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension Post6 { +public extension Post6 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case blog case comments } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post6 = Post6.keys model.listPluralName = "Post6s" diff --git a/AmplifyTestCommon/Models/Collection/6/Post6.swift b/AmplifyTestCommon/Models/Collection/6/Post6.swift index a470246a15..33840ae236 100644 --- a/AmplifyTestCommon/Models/Collection/6/Post6.swift +++ b/AmplifyTestCommon/Models/Collection/6/Post6.swift @@ -18,7 +18,8 @@ public struct Post6: Model { 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 fe7813fada..8879a10823 100644 --- a/AmplifyTestCommon/Models/Comment+Schema.swift +++ b/AmplifyTestCommon/Models/Comment+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension Comment { +public extension Comment { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case createdAt case post } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment = Comment.keys model.listPluralName = "Comments" @@ -35,9 +36,9 @@ extension Comment { ) } - public class Path : ModelPath {} + class Path: ModelPath {} - public static var rootPath: PropertyContainerPath? { Path() } + static var rootPath: PropertyContainerPath? { Path() } } diff --git a/AmplifyTestCommon/Models/Comment.swift b/AmplifyTestCommon/Models/Comment.swift index 2f223e38aa..97d1dde767 100644 --- a/AmplifyTestCommon/Models/Comment.swift +++ b/AmplifyTestCommon/Models/Comment.swift @@ -13,31 +13,32 @@ public struct Comment: Model { public let id: String public var content: String public var createdAt: Temporal.DateTime - internal var _post: LazyReference + var _post: LazyReference public var post: Post { get async throws { try await _post.require() } } - + public init(id: String = UUID().uuidString, content: String, createdAt: Temporal.DateTime, - post: Post) { + post: Post) + { self.id = id self.content = content self.createdAt = createdAt self._post = LazyReference(post) } - + public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try values.decode(String.self, forKey: .content) - createdAt = try values.decode(Temporal.DateTime.self, forKey: .createdAt) - _post = try values.decode(LazyReference.self, forKey: .post) + self.id = try values.decode(String.self, forKey: .id) + self.content = try values.decode(String.self, forKey: .content) + self.createdAt = try values.decode(Temporal.DateTime.self, forKey: .createdAt) + self._post = try values.decode(LazyReference.self, forKey: .post) } - + public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey+Schema.swift index ced19ca608..439e00f439 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension CommentWithCompositeKey { +public extension CommentWithCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case post @@ -19,10 +20,10 @@ extension CommentWithCompositeKey { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let commentWithCompositeKey = CommentWithCompositeKey.keys model.pluralName = "CommentWithCompositeKeys" @@ -47,9 +48,10 @@ extension CommentWithCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension CommentWithCompositeKey.IdentifierProtocol { - public static func identifier(id: String, - content: String) -> Self { +public extension CommentWithCompositeKey.IdentifierProtocol { + 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 e29a37c037..3c24d4c559 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKey.swift @@ -18,18 +18,20 @@ public struct CommentWithCompositeKey: Model { public init(id: String = UUID().uuidString, content: String, - post: PostWithCompositeKey? = nil) { + post: PostWithCompositeKey? = nil) + { self.init(id: id, content: content, post: post, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String, post: PostWithCompositeKey? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 49d6789653..859e039156 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension CommentWithCompositeKeyAndIndex { +public extension CommentWithCompositeKeyAndIndex { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case post @@ -19,10 +20,10 @@ extension CommentWithCompositeKeyAndIndex { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let commentWithCompositeKeyAndIndex = CommentWithCompositeKeyAndIndex.keys model.pluralName = "CommentWithCompositeKeyAndIndices" @@ -48,9 +49,10 @@ extension CommentWithCompositeKeyAndIndex: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension CommentWithCompositeKeyAndIndex.IdentifierProtocol { - public static func identifier(id: String, - content: String) -> Self { +public extension CommentWithCompositeKeyAndIndex.IdentifierProtocol { + 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 64742b54bc..c44267c1c6 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyAndIndex.swift @@ -18,18 +18,20 @@ public struct CommentWithCompositeKeyAndIndex: Model { public init(id: String = UUID().uuidString, content: String, - post: PostWithCompositeKeyAndIndex? = nil) { + post: PostWithCompositeKeyAndIndex? = nil) + { self.init(id: id, content: content, post: post, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String, post: PostWithCompositeKeyAndIndex? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 91a30cf9de..13e411e09e 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension CommentWithCompositeKeyUnidirectional { +public extension CommentWithCompositeKeyUnidirectional { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case createdAt @@ -20,10 +21,10 @@ extension CommentWithCompositeKeyUnidirectional { case postWithCompositeKeyUnidirectionalCommentsTitle } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let commentWithCompositeKeyUnidirectional = CommentWithCompositeKeyUnidirectional.keys model.pluralName = "CommentWithCompositeKeyUnidirectionals" @@ -49,9 +50,10 @@ extension CommentWithCompositeKeyUnidirectional: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension CommentWithCompositeKeyUnidirectional.IdentifierProtocol { - public static func identifier(id: String, - content: String) -> Self { +public extension CommentWithCompositeKeyUnidirectional.IdentifierProtocol { + 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 23617b6d3e..b4b414e54d 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/CommentWithCompositeKeyUnidirectional.swift @@ -20,7 +20,8 @@ public struct CommentWithCompositeKeyUnidirectional: Model { public init(id: String = UUID().uuidString, content: String, post21CommentsId: String? = nil, - post21CommentsTitle: String? = nil) { + post21CommentsTitle: String? = nil) + { self.init(id: id, content: content, createdAt: nil, @@ -28,12 +29,13 @@ public struct CommentWithCompositeKeyUnidirectional: Model { postWithCompositeKeyUnidirectionalCommentsId: post21CommentsId, postWithCompositeKeyUnidirectionalCommentsTitle: post21CommentsTitle) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String, createdAt: Temporal.DateTime? = nil, updatedAt: Temporal.DateTime? = nil, postWithCompositeKeyUnidirectionalCommentsId: String? = nil, - postWithCompositeKeyUnidirectionalCommentsTitle: 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 5668fa4b33..6027443328 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension ModelCompositeIntPk { +public extension ModelCompositeIntPk { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case serial case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let modelCompositeIntPk = ModelCompositeIntPk.keys model.pluralName = "ModelCompositeIntPks" @@ -46,8 +47,8 @@ extension ModelCompositeIntPk: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension ModelCompositeIntPk.IdentifierProtocol { - public static func identifier(id: String, serial: Int) -> Self { +public extension ModelCompositeIntPk.IdentifierProtocol { + static func identifier(id: String, serial: Int) -> Self { .make(fields: [(name: "id", value: id), (name: "serial", value: serial)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk.swift index e0bd650570..f3751e7a1e 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositeIntPk.swift @@ -16,16 +16,18 @@ public struct ModelCompositeIntPk: Model { public var updatedAt: Temporal.DateTime? public init(id: String = UUID().uuidString, - serial: Int) { + serial: Int) + { self.init(id: id, serial: serial, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, serial: Int, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 a827c2fed6..beca197698 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension ModelCompositePk { +public extension ModelCompositePk { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case dob case name @@ -19,10 +20,10 @@ extension ModelCompositePk { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let modelCompositePk = ModelCompositePk.keys model.pluralName = "ModelCompositePks" @@ -46,8 +47,8 @@ extension ModelCompositePk: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension ModelCompositePk.IdentifierProtocol { - public static func identifier(id: String, dob: Temporal.DateTime) -> Self { +public extension ModelCompositePk.IdentifierProtocol { + static func identifier(id: String, dob: Temporal.DateTime) -> Self { .make(fields: [(name: "id", value: id), (name: "dob", value: dob)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk.swift index 755bfa19d2..13571b5654 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePk.swift @@ -18,18 +18,20 @@ public struct ModelCompositePk: Model { public init(id: String = UUID().uuidString, dob: Temporal.DateTime, - name: String? = nil) { + name: String? = nil) + { self.init(id: id, dob: dob, name: name, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, dob: Temporal.DateTime, name: String? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 525ecc5ce5..5985f5701b 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension ModelCompositePkBelongsTo { +public extension ModelCompositePkBelongsTo { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case dob case owner @@ -20,10 +21,10 @@ extension ModelCompositePkBelongsTo { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let modelCompositePkBelongsTo = ModelCompositePkBelongsTo.keys model.pluralName = "ModelCompositePkBelongsTos" @@ -53,8 +54,8 @@ extension ModelCompositePkBelongsTo: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension ModelCompositePkBelongsTo.IdentifierProtocol { - public static func identifier(id: String, dob: Temporal.DateTime) -> Self { +public extension ModelCompositePkBelongsTo.IdentifierProtocol { + static func identifier(id: String, dob: Temporal.DateTime) -> Self { .make(fields: [(name: "id", value: id), (name: "dob", value: dob)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo.swift index 4d4817d0fc..978eba0d68 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkBelongsTo.swift @@ -20,7 +20,8 @@ public struct ModelCompositePkBelongsTo: Model { public init(id: String = UUID().uuidString, dob: Temporal.DateTime, name: String? = nil, - owner: ModelCompositePkWithAssociation? = nil) { + owner: ModelCompositePkWithAssociation? = nil) + { self.init(id: id, dob: dob, name: name, @@ -28,12 +29,13 @@ public struct ModelCompositePkBelongsTo: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, dob: Temporal.DateTime, name: String? = nil, owner: ModelCompositePkWithAssociation? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 cbb3bc7f85..08d08c91b8 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension ModelCompositePkWithAssociation { +public extension ModelCompositePkWithAssociation { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case dob case name @@ -20,10 +21,10 @@ extension ModelCompositePkWithAssociation { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let modelCompositePkWithAssociation = ModelCompositePkWithAssociation.keys model.pluralName = "ModelCompositePkWithAssociations" @@ -51,8 +52,8 @@ extension ModelCompositePkWithAssociation: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension ModelCompositePkWithAssociation.IdentifierProtocol { - public static func identifier(id: String, dob: Temporal.DateTime) -> Self { +public extension ModelCompositePkWithAssociation.IdentifierProtocol { + static func identifier(id: String, dob: Temporal.DateTime) -> Self { .make(fields: [(name: "id", value: id), (name: "dob", value: dob)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation.swift index 810e0e9a3f..bafa9a013d 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCompositePkWithAssociation.swift @@ -20,7 +20,8 @@ public struct ModelCompositePkWithAssociation: Model { public init(id: String = UUID().uuidString, dob: Temporal.DateTime, name: String? = nil, - otherModels: List? = []) { + otherModels: List? = []) + { self.init(id: id, dob: dob, name: name, @@ -28,12 +29,13 @@ public struct ModelCompositePkWithAssociation: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, dob: Temporal.DateTime, name: String? = nil, otherModels: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 651ae307db..3fda821de3 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPKDefined.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPKDefined.swift @@ -18,18 +18,20 @@ public struct ModelCustomPkDefined: Model { public init(id: String = UUID().uuidString, dob: Temporal.DateTime, - name: String? = nil) { + name: String? = nil) + { self.init(id: id, dob: dob, name: name, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, dob: Temporal.DateTime, name: String? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 49c4b706a5..46f41f2031 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPkDefined+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelCustomPkDefined+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension ModelCustomPkDefined { +public extension ModelCustomPkDefined { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case dob case name @@ -19,10 +20,10 @@ extension ModelCustomPkDefined { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let modelCompositePk = ModelCustomPkDefined.keys model.pluralName = "ModelCustomPkDefined" @@ -48,8 +49,8 @@ extension ModelCustomPkDefined: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension ModelCustomPkDefined.IdentifierProtocol { - public static func identifier(id: String, dob: Temporal.DateTime) -> Self { +public extension ModelCustomPkDefined.IdentifierProtocol { + static func identifier(id: String, dob: Temporal.DateTime) -> Self { .make(fields: [(name: "id", value: id), (name: "dob", value: dob)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk+Schema.swift index 8ea03e2dc2..95d6f4d317 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension ModelExplicitCustomPk { +public extension ModelExplicitCustomPk { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case userId case name case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let modelExplicitCustomPk = ModelExplicitCustomPk.keys model.pluralName = "ModelExplicitCustomPks" @@ -44,8 +45,8 @@ extension ModelExplicitCustomPk: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension ModelExplicitCustomPk.IdentifierProtocol { - public static func identifier(userId: String) -> Self { +public extension ModelExplicitCustomPk.IdentifierProtocol { + static func identifier(userId: String) -> Self { .make(fields: [(name: "userId", value: userId)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk.swift index e1f809db6a..3e197b7a68 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitCustomPk.swift @@ -21,10 +21,11 @@ public struct ModelExplicitCustomPk: Model { createdAt: nil, updatedAt: nil) } - internal init(userId: String, + init(userId: String, name: String? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 e7de2f2f80..543d116a12 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension ModelExplicitDefaultPk { +public extension ModelExplicitDefaultPk { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let modelExplicitDefaultPk = ModelExplicitDefaultPk.keys model.pluralName = "ModelExplicitDefaultPks" @@ -44,8 +45,8 @@ extension ModelExplicitDefaultPk: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension ModelExplicitDefaultPk.IdentifierProtocol { - public static func identifier(id: String) -> Self { +public extension ModelExplicitDefaultPk.IdentifierProtocol { + static func identifier(id: String) -> Self { .make(fields: [(name: "id", value: id)]) } } diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk.swift index cd44b3b9e7..a166370ac9 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelExplicitDefaultPk.swift @@ -16,16 +16,18 @@ public struct ModelExplicitDefaultPk: Model { public var updatedAt: Temporal.DateTime? public init(id: String = UUID().uuidString, - name: String? = nil) { + name: String? = nil) + { self.init(id: id, name: name, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 9519e91e03..b9a36425d6 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension ModelImplicitDefaultPk { +public extension ModelImplicitDefaultPk { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let modelImplicitDefaultPk = ModelImplicitDefaultPk.keys model.pluralName = "ModelImplicitDefaultPks" diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk.swift index 57bb5def66..12c45ddc38 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/ModelImplicitDefaultPk.swift @@ -16,16 +16,18 @@ public struct ModelImplicitDefaultPk: Model { public var updatedAt: Temporal.DateTime? public init(id: String = UUID().uuidString, - name: String? = nil) { + name: String? = nil) + { self.init(id: id, name: name, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 a78c515f67..b9ed258200 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension PostTagsWithCompositeKey { +public extension PostTagsWithCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case postWithTagsCompositeKey case tagWithCompositeKey @@ -19,10 +20,10 @@ extension PostTagsWithCompositeKey { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let postTagsWithCompositeKey = PostTagsWithCompositeKey.keys model.pluralName = "PostTagsWithCompositeKeys" diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey.swift index 1686ec3e48..278448b077 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostTagsWithCompositeKey.swift @@ -18,18 +18,20 @@ public struct PostTagsWithCompositeKey: Model { public init(id: String = UUID().uuidString, postWithTagsCompositeKey: PostWithTagsCompositeKey, - tagWithCompositeKey: TagWithCompositeKey) { + tagWithCompositeKey: TagWithCompositeKey) + { self.init(id: id, postWithTagsCompositeKey: postWithTagsCompositeKey, tagWithCompositeKey: tagWithCompositeKey, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, postWithTagsCompositeKey: PostWithTagsCompositeKey, tagWithCompositeKey: TagWithCompositeKey, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 d06ac91c7f..b5765f842d 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension PostWithCompositeKey { +public extension PostWithCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case comments @@ -19,10 +20,10 @@ extension PostWithCompositeKey { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post22 = PostWithCompositeKey.keys model.pluralName = "PostWithCompositeKeys" @@ -47,9 +48,10 @@ extension PostWithCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension PostWithCompositeKey.IdentifierProtocol { - public static func identifier(id: String, - title: String) -> Self { +public extension PostWithCompositeKey.IdentifierProtocol { + 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 16bd0ce395..9cde114f09 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKey.swift @@ -18,18 +18,20 @@ public struct PostWithCompositeKey: Model { public init(id: String = UUID().uuidString, title: String, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, comments: comments, createdAt: nil, updatedAt: nil) } - internal 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 diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex+Schema.swift index be2161d7ba..8c8fbefcda 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension PostWithCompositeKeyAndIndex { +public extension PostWithCompositeKeyAndIndex { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case comments @@ -19,10 +20,10 @@ extension PostWithCompositeKeyAndIndex { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let postWithCompositeKeyAndIndex = PostWithCompositeKeyAndIndex.keys model.pluralName = "PostWithCompositeKeyAndIndices" @@ -47,9 +48,10 @@ extension PostWithCompositeKeyAndIndex: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension PostWithCompositeKeyAndIndex.IdentifierProtocol { - public static func identifier(id: String, - title: String) -> Self { +public extension PostWithCompositeKeyAndIndex.IdentifierProtocol { + 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 d642b4b980..f9e95f5fd9 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyAndIndex.swift @@ -18,18 +18,20 @@ public struct PostWithCompositeKeyAndIndex: Model { public init(id: String = UUID().uuidString, title: String, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, comments: comments, createdAt: nil, updatedAt: nil) } - internal 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 diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional+Schema.swift index 3148b8c002..5e3ea9c581 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension PostWithCompositeKeyUnidirectional { +public extension PostWithCompositeKeyUnidirectional { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case comments @@ -19,10 +20,10 @@ extension PostWithCompositeKeyUnidirectional { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let postWithCompositeKeyUnidirectional = PostWithCompositeKeyUnidirectional.keys model.pluralName = "PostWithCompositeKeyUnidirectionals" @@ -50,9 +51,10 @@ extension PostWithCompositeKeyUnidirectional: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension PostWithCompositeKeyUnidirectional.IdentifierProtocol { - public static func identifier(id: String, - title: String) -> Self { +public extension PostWithCompositeKeyUnidirectional.IdentifierProtocol { + 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 23bffde135..2b7d94426a 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithCompositeKeyUnidirectional.swift @@ -18,18 +18,20 @@ public struct PostWithCompositeKeyUnidirectional: Model { public init(id: String = UUID().uuidString, title: String, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, comments: comments, createdAt: nil, updatedAt: nil) } - internal 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 diff --git a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey+Schema.swift b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey+Schema.swift index e1a30d6816..4ab74d79f1 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension PostWithTagsCompositeKey { +public extension PostWithTagsCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case postId case title case tags @@ -19,10 +20,10 @@ extension PostWithTagsCompositeKey { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let postWithTagsCompositeKey = PostWithTagsCompositeKey.keys model.pluralName = "PostWithTagsCompositeKeys" @@ -47,9 +48,10 @@ extension PostWithTagsCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension PostWithTagsCompositeKey.IdentifierProtocol { - public static func identifier(postId: String, - title: String) -> Self { +public extension PostWithTagsCompositeKey.IdentifierProtocol { + 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 65baeac282..b4445634f8 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/PostWithTagsCompositeKey.swift @@ -18,18 +18,20 @@ public struct PostWithTagsCompositeKey: Model { public init(postId: String, title: String, - tags: List? = []) { + tags: List? = []) + { self.init(postId: postId, title: title, tags: tags, createdAt: nil, updatedAt: nil) } - internal init(postId: String, + init(postId: String, title: String, tags: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 4d65058a00..b7faf654fc 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey+Schema.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension TagWithCompositeKey { +public extension TagWithCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case posts @@ -19,10 +20,10 @@ extension TagWithCompositeKey { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let tagWithCompositeKey = TagWithCompositeKey.keys model.pluralName = "TagWithCompositeKeys" @@ -47,9 +48,10 @@ extension TagWithCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension TagWithCompositeKey.IdentifierProtocol { - public static func identifier(id: String, - name: String) -> Self { +public extension TagWithCompositeKey.IdentifierProtocol { + 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 0c3a360868..b621d63c3d 100644 --- a/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey.swift +++ b/AmplifyTestCommon/Models/CustomPrimaryKey/TagWithCompositeKey.swift @@ -18,18 +18,20 @@ public struct TagWithCompositeKey: Model { public init(id: String = UUID().uuidString, name: String, - posts: List? = []) { + posts: List? = []) + { self.init(id: id, name: name, posts: posts, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, posts: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 c672f13325..b5e15f4ad9 100644 --- a/AmplifyTestCommon/Models/CustomerOrder+Schema.swift +++ b/AmplifyTestCommon/Models/CustomerOrder+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension CustomerOrder { +public extension CustomerOrder { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case orderId case email } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let customerOrder = CustomerOrder.keys model.listPluralName = "CustomerOrders" diff --git a/AmplifyTestCommon/Models/CustomerOrder.swift b/AmplifyTestCommon/Models/CustomerOrder.swift index 92609d0848..521794fcc1 100644 --- a/AmplifyTestCommon/Models/CustomerOrder.swift +++ b/AmplifyTestCommon/Models/CustomerOrder.swift @@ -24,7 +24,8 @@ public struct CustomerOrder: Model { 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 2e364e24d6..80b368a696 100644 --- a/AmplifyTestCommon/Models/Deprecated/DeprecatedTodo.swift +++ b/AmplifyTestCommon/Models/Deprecated/DeprecatedTodo.swift @@ -8,6 +8,7 @@ // swiftlint:disable all import Amplify import Foundation + /* The schema used to codegen this model: type DeprecatedTodo @model { @@ -32,25 +33,27 @@ public struct DeprecatedTodo: Model { public init(id: String = UUID().uuidString, description: String? = nil, - note: Note? = nil) { + note: Note? = nil) + { self.id = id self.description = description self.note = note } } -extension DeprecatedTodo { +public extension DeprecatedTodo { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case description case note } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let deprecatedTodo = DeprecatedTodo.keys model.pluralName = "DeprecatedTodos" diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost+Schema.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost+Schema.swift index 7d700109e9..4071577e07 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost+Schema.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension M2MPost { +public extension M2MPost { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case editors } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let m2MPost = M2MPost.keys model.listPluralName = "M2MPosts" diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost.swift index 38b678400f..7317a08327 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPost.swift @@ -16,7 +16,8 @@ public struct M2MPost: Model { 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 7c48259298..74e00b969a 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor+Schema.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension M2MPostEditor { +public extension M2MPostEditor { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case post case editor } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let m2MPostEditor = M2MPostEditor.keys model.listPluralName = "M2MPostEditors" diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor.swift index f90b4ec386..42fba8f759 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MPostEditor.swift @@ -16,7 +16,8 @@ public struct M2MPostEditor: Model { 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 452ca2b270..afb297da42 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser+Schema.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension M2MUser { +public extension M2MUser { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case username case posts } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let m2MUser = M2MUser.keys model.listPluralName = "M2MUsers" diff --git a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser.swift b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser.swift index 076f5fb3b5..a42166a34a 100644 --- a/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser.swift +++ b/AmplifyTestCommon/Models/M2MPostEditorUser/M2MUser.swift @@ -16,7 +16,8 @@ public struct M2MUser: Model { 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 277b136bf2..13ce40cc2c 100644 --- a/AmplifyTestCommon/Models/NonModel/Category.swift +++ b/AmplifyTestCommon/Models/NonModel/Category.swift @@ -14,16 +14,16 @@ public struct Category: Embeddable { var color: Color } -extension Category { +public extension Category { - public enum CodingKeys: CodingKey { + enum CodingKeys: CodingKey { case name case color } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self - public static let schema = defineSchema { embedded in + 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))) diff --git a/AmplifyTestCommon/Models/NonModel/Color.swift b/AmplifyTestCommon/Models/NonModel/Color.swift index 793b6a6844..b4d534ea82 100644 --- a/AmplifyTestCommon/Models/NonModel/Color.swift +++ b/AmplifyTestCommon/Models/NonModel/Color.swift @@ -16,17 +16,17 @@ public struct Color: Embeddable { var blue: Int } -extension Color { - public enum CodingKeys: CodingKey { +public extension Color { + enum CodingKeys: CodingKey { case name case red case green case blue } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self - public static let schema = defineSchema { embedded in + 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), diff --git a/AmplifyTestCommon/Models/NonModel/DynamicEmbedded.swift b/AmplifyTestCommon/Models/NonModel/DynamicEmbedded.swift index 2636100012..1ee5997d5e 100644 --- a/AmplifyTestCommon/Models/NonModel/DynamicEmbedded.swift +++ b/AmplifyTestCommon/Models/NonModel/DynamicEmbedded.swift @@ -18,7 +18,7 @@ struct DynamicEmbedded: Embeddable, JSONValueHolder { public init(from decoder: Decoder) throws { let json = try JSONValue(from: decoder) if case .object(let jsonValue) = json { - values = jsonValue + self.values = jsonValue } else { self.values = [:] } @@ -51,7 +51,8 @@ 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 a88cfeb7fe..44135ba27b 100644 --- a/AmplifyTestCommon/Models/NonModel/DynamicModel.swift +++ b/AmplifyTestCommon/Models/NonModel/DynamicModel.swift @@ -21,10 +21,10 @@ struct DynamicModel: Model, JSONValueHolder { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - id = try container.decode(String.self, forKey: .id) + self.id = try container.decode(String.self, forKey: .id) let json = try JSONValue(from: decoder) if case .object(let jsonValues) = json { - values = jsonValues + self.values = jsonValues } else { self.values = [:] } @@ -60,7 +60,8 @@ 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 0ffd42eb2f..893f9b02c0 100644 --- a/AmplifyTestCommon/Models/NonModel/Section.swift +++ b/AmplifyTestCommon/Models/NonModel/Section.swift @@ -14,15 +14,15 @@ public struct Section: Embeddable { var number: Double } -extension Section { - public enum CodingKeys: CodingKey { +public extension Section { + enum CodingKeys: CodingKey { case name case number } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self - public static let schema = defineSchema { embedded in + 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)) diff --git a/AmplifyTestCommon/Models/NonModel/Todo+Schema.swift b/AmplifyTestCommon/Models/NonModel/Todo+Schema.swift index d53b4c0e07..a274488025 100644 --- a/AmplifyTestCommon/Models/NonModel/Todo+Schema.swift +++ b/AmplifyTestCommon/Models/NonModel/Todo+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Todo { +public extension Todo { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case description @@ -20,10 +21,10 @@ extension Todo { case stickies } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let todo = Todo.keys model.listPluralName = "Todos" diff --git a/AmplifyTestCommon/Models/NonModel/Todo.swift b/AmplifyTestCommon/Models/NonModel/Todo.swift index 423f2aa568..62de6f8d6e 100644 --- a/AmplifyTestCommon/Models/NonModel/Todo.swift +++ b/AmplifyTestCommon/Models/NonModel/Todo.swift @@ -8,6 +8,7 @@ // swiftlint:disable all import Amplify import Foundation + /* The schema used to codegen this model: type Todo @model { @@ -50,7 +51,8 @@ public struct Todo: Model { description: String? = nil, categories: [Category]? = [], section: Section? = nil, - stickies: [String]? = []) { + 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 69170decb4..8dd439f20f 100644 --- a/AmplifyTestCommon/Models/OGCScenarioBMGroupPost+Schema.swift +++ b/AmplifyTestCommon/Models/OGCScenarioBMGroupPost+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension OGCScenarioBMGroupPost { +public extension OGCScenarioBMGroupPost { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case owner } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let oGCScenarioBMGroupPost = OGCScenarioBMGroupPost.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/OGCScenarioBMGroupPost.swift b/AmplifyTestCommon/Models/OGCScenarioBMGroupPost.swift index 64ab04bf3f..b1c6783b35 100644 --- a/AmplifyTestCommon/Models/OGCScenarioBMGroupPost.swift +++ b/AmplifyTestCommon/Models/OGCScenarioBMGroupPost.swift @@ -16,7 +16,8 @@ public struct OGCScenarioBMGroupPost: Model { 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 2a3c67066f..5f5aef170b 100644 --- a/AmplifyTestCommon/Models/OGCScenarioBPost+Schema.swift +++ b/AmplifyTestCommon/Models/OGCScenarioBPost+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension OGCScenarioBPost { +public extension OGCScenarioBPost { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case owner } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let oGCScenarioBPost = OGCScenarioBPost.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/OGCScenarioBPost.swift b/AmplifyTestCommon/Models/OGCScenarioBPost.swift index 5ee8d97fb9..fa98a24586 100644 --- a/AmplifyTestCommon/Models/OGCScenarioBPost.swift +++ b/AmplifyTestCommon/Models/OGCScenarioBPost.swift @@ -16,7 +16,8 @@ public struct OGCScenarioBPost: Model { 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 f60062941d..10639d312f 100644 --- a/AmplifyTestCommon/Models/Post+Schema.swift +++ b/AmplifyTestCommon/Models/Post+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Post { +public extension Post { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case content @@ -23,10 +24,10 @@ extension Post { case comments } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post = Post.keys model.listPluralName = "Posts" @@ -45,9 +46,9 @@ extension Post { ) } - public class Path : ModelPath {} + class Path: ModelPath {} - public static var rootPath: PropertyContainerPath? { Path() } + static var rootPath: PropertyContainerPath? { Path() } } diff --git a/AmplifyTestCommon/Models/Post.swift b/AmplifyTestCommon/Models/Post.swift index 282bd91846..ea920cf24e 100644 --- a/AmplifyTestCommon/Models/Post.swift +++ b/AmplifyTestCommon/Models/Post.swift @@ -28,7 +28,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/PostCommentModelRegistration.swift b/AmplifyTestCommon/Models/PostCommentModelRegistration.swift index b3c1e7a4a1..b3e51e7f77 100644 --- a/AmplifyTestCommon/Models/PostCommentModelRegistration.swift +++ b/AmplifyTestCommon/Models/PostCommentModelRegistration.swift @@ -8,7 +8,7 @@ import Amplify import Foundation -final public class PostCommentModelRegistration: AmplifyModelRegistration { +public final class PostCommentModelRegistration: AmplifyModelRegistration { public func registerModels(registry: ModelRegistry.Type) { ModelRegistry.register(modelType: Post.self) ModelRegistry.register(modelType: Comment.self) diff --git a/AmplifyTestCommon/Models/QPredGen+Schema.swift b/AmplifyTestCommon/Models/QPredGen+Schema.swift index 4571c1ed25..5ec9920515 100644 --- a/AmplifyTestCommon/Models/QPredGen+Schema.swift +++ b/AmplifyTestCommon/Models/QPredGen+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension QPredGen { +public extension QPredGen { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case myBool @@ -23,10 +24,10 @@ extension QPredGen { case myTime } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let qPredGen = QPredGen.keys model.listPluralName = "QPredGens" diff --git a/AmplifyTestCommon/Models/QPredGen.swift b/AmplifyTestCommon/Models/QPredGen.swift index b26ad62ede..c02f5c7deb 100644 --- a/AmplifyTestCommon/Models/QPredGen.swift +++ b/AmplifyTestCommon/Models/QPredGen.swift @@ -8,6 +8,7 @@ // swiftlint:disable all import Amplify import Foundation + /* Generated from: @@ -42,7 +43,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 7df7ca922e..ca3365f681 100644 --- a/AmplifyTestCommon/Models/Record+Schema.swift +++ b/AmplifyTestCommon/Models/Record+Schema.swift @@ -5,13 +5,15 @@ // SPDX-License-Identifier: Apache-2.0 // +import Amplify + // swiftlint:disable all import Foundation -import Amplify -extension Record { +public extension Record { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case description @@ -21,10 +23,10 @@ extension Record { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let record = Record.keys model.listPluralName = "Records" diff --git a/AmplifyTestCommon/Models/Record.swift b/AmplifyTestCommon/Models/Record.swift index 6b8f224c54..b3214d1747 100644 --- a/AmplifyTestCommon/Models/Record.swift +++ b/AmplifyTestCommon/Models/Record.swift @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import Amplify + // swiftlint:disable all import Foundation -import Amplify public struct Record: Model { public let id: String @@ -19,7 +20,8 @@ public struct Record: Model { public let updatedAt: Temporal.DateTime? public init(name: String, - description: String? = nil) { + description: String? = nil) + { self.init(name: name, description: description, coverId: nil, @@ -28,13 +30,14 @@ public struct Record: Model { updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, description: String? = nil, coverId: String? = nil, cover: RecordCover? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 04f4f8a460..aba336a509 100644 --- a/AmplifyTestCommon/Models/RecordCover+Schema.swift +++ b/AmplifyTestCommon/Models/RecordCover+Schema.swift @@ -5,23 +5,25 @@ // SPDX-License-Identifier: Apache-2.0 // +import Amplify + // swiftlint:disable all import Foundation -import Amplify -extension RecordCover { +public extension RecordCover { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case artist case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let recordCover = RecordCover.keys model.listPluralName = "RecordCovers" diff --git a/AmplifyTestCommon/Models/RecordCover.swift b/AmplifyTestCommon/Models/RecordCover.swift index 21d00c458f..22ac2e0121 100644 --- a/AmplifyTestCommon/Models/RecordCover.swift +++ b/AmplifyTestCommon/Models/RecordCover.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation // swiftlint:disable all @@ -22,10 +22,11 @@ public struct RecordCover: Model { updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, artist: String, createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + updatedAt: Temporal.DateTime? = nil) + { self.id = id self.artist = artist self.createdAt = createdAt diff --git a/AmplifyTestCommon/Models/ReservedWords/Group+Schema.swift b/AmplifyTestCommon/Models/ReservedWords/Group+Schema.swift index e7a80ecd9b..9bbab7d799 100644 --- a/AmplifyTestCommon/Models/ReservedWords/Group+Schema.swift +++ b/AmplifyTestCommon/Models/ReservedWords/Group+Schema.swift @@ -5,19 +5,19 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation -extension Group { +public extension Group { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let group = Group.keys model.listPluralName = "Groups" diff --git a/AmplifyTestCommon/Models/ReservedWords/Group.swift b/AmplifyTestCommon/Models/ReservedWords/Group.swift index 2a270048e6..5452511e2f 100644 --- a/AmplifyTestCommon/Models/ReservedWords/Group.swift +++ b/AmplifyTestCommon/Models/ReservedWords/Group.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation public struct Group: Model { public let id: String diff --git a/AmplifyTestCommon/Models/ReservedWords/Row+Schema.swift b/AmplifyTestCommon/Models/ReservedWords/Row+Schema.swift index 6878da26b5..3e55c96621 100644 --- a/AmplifyTestCommon/Models/ReservedWords/Row+Schema.swift +++ b/AmplifyTestCommon/Models/ReservedWords/Row+Schema.swift @@ -5,20 +5,20 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation -extension Row { +public extension Row { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case group } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let row = Row.keys model.listPluralName = "Rows" diff --git a/AmplifyTestCommon/Models/ReservedWords/Row.swift b/AmplifyTestCommon/Models/ReservedWords/Row.swift index 496c3426e7..738ae2860c 100644 --- a/AmplifyTestCommon/Models/ReservedWords/Row.swift +++ b/AmplifyTestCommon/Models/ReservedWords/Row.swift @@ -5,15 +5,16 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation public struct Row: Model { public let id: String public var group: Group public init(id: String = UUID().uuidString, - group: Group) { + group: Group) + { self.id = id self.group = group } diff --git a/AmplifyTestCommon/Models/ReservedWords/Transaction+Schema.swift b/AmplifyTestCommon/Models/ReservedWords/Transaction+Schema.swift index 8c5ac3a9b0..4dc6dcfcfb 100644 --- a/AmplifyTestCommon/Models/ReservedWords/Transaction+Schema.swift +++ b/AmplifyTestCommon/Models/ReservedWords/Transaction+Schema.swift @@ -5,20 +5,21 @@ // SPDX-License-Identifier: Apache-2.0 // +import Amplify + // swiftlint:disable all import Foundation -import Amplify -extension Transaction { +public extension Transaction { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let transaction = Transaction.keys model.listPluralName = "Transactions" diff --git a/AmplifyTestCommon/Models/ReservedWords/Transaction.swift b/AmplifyTestCommon/Models/ReservedWords/Transaction.swift index 0cdd05cc3c..0c249b049a 100644 --- a/AmplifyTestCommon/Models/ReservedWords/Transaction.swift +++ b/AmplifyTestCommon/Models/ReservedWords/Transaction.swift @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import Amplify + // swiftlint:disable all import Foundation -import Amplify public struct Transaction: Model { public let id: String diff --git a/AmplifyTestCommon/Models/Restaurant/Dish+Schema.swift b/AmplifyTestCommon/Models/Restaurant/Dish+Schema.swift index 3022b9e276..afe899a55a 100644 --- a/AmplifyTestCommon/Models/Restaurant/Dish+Schema.swift +++ b/AmplifyTestCommon/Models/Restaurant/Dish+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Dish { +public extension Dish { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case dishName case menu } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let dish = Dish.keys model.listPluralName = "Dishes" diff --git a/AmplifyTestCommon/Models/Restaurant/Dish.swift b/AmplifyTestCommon/Models/Restaurant/Dish.swift index 73fe887fe0..b5d5667f7f 100644 --- a/AmplifyTestCommon/Models/Restaurant/Dish.swift +++ b/AmplifyTestCommon/Models/Restaurant/Dish.swift @@ -16,7 +16,8 @@ public struct Dish: Model { 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 e3188b3f4f..9888c51eb5 100644 --- a/AmplifyTestCommon/Models/Restaurant/Menu+Schema.swift +++ b/AmplifyTestCommon/Models/Restaurant/Menu+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Menu { +public extension Menu { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case menuType @@ -19,10 +20,10 @@ extension Menu { case dishes } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let menu = Menu.keys model.listPluralName = "Menus" diff --git a/AmplifyTestCommon/Models/Restaurant/Menu.swift b/AmplifyTestCommon/Models/Restaurant/Menu.swift index 5b571fef48..564768a79b 100644 --- a/AmplifyTestCommon/Models/Restaurant/Menu.swift +++ b/AmplifyTestCommon/Models/Restaurant/Menu.swift @@ -20,7 +20,8 @@ public struct Menu: Model { 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 6d677b46aa..d1e7c68f7d 100644 --- a/AmplifyTestCommon/Models/Restaurant/Restaurant+Schema.swift +++ b/AmplifyTestCommon/Models/Restaurant/Restaurant+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Restaurant { +public extension Restaurant { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case restaurantName case menus } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let restaurant = Restaurant.keys model.listPluralName = "Restaurants" diff --git a/AmplifyTestCommon/Models/Restaurant/Restaurant.swift b/AmplifyTestCommon/Models/Restaurant/Restaurant.swift index 37ce26d911..d8e7cbdfd5 100644 --- a/AmplifyTestCommon/Models/Restaurant/Restaurant.swift +++ b/AmplifyTestCommon/Models/Restaurant/Restaurant.swift @@ -16,7 +16,8 @@ public struct Restaurant: Model { 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 05ff5b0fbc..b59675601f 100644 --- a/AmplifyTestCommon/Models/Scalar/EnumTestModel+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/EnumTestModel+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension EnumTestModel { +public extension EnumTestModel { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case enumVal case nullableEnumVal @@ -21,10 +22,10 @@ extension EnumTestModel { case nullableEnumNullableList } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let enumTestModel = EnumTestModel.keys model.listPluralName = "EnumTestModels" diff --git a/AmplifyTestCommon/Models/Scalar/EnumTestModel.swift b/AmplifyTestCommon/Models/Scalar/EnumTestModel.swift index 65fe699440..6f6610f22b 100644 --- a/AmplifyTestCommon/Models/Scalar/EnumTestModel.swift +++ b/AmplifyTestCommon/Models/Scalar/EnumTestModel.swift @@ -24,7 +24,8 @@ public struct EnumTestModel: Model { 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 6ef039ff38..00497b1fe4 100644 --- a/AmplifyTestCommon/Models/Scalar/ListIntContainer+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/ListIntContainer+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension ListIntContainer { +public extension ListIntContainer { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case test case nullableInt @@ -21,10 +22,10 @@ extension ListIntContainer { case nullableIntNullableList } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let listIntContainer = ListIntContainer.keys model.listPluralName = "ListIntContainers" diff --git a/AmplifyTestCommon/Models/Scalar/ListIntContainer.swift b/AmplifyTestCommon/Models/Scalar/ListIntContainer.swift index 4dd8862fe3..019eba2286 100644 --- a/AmplifyTestCommon/Models/Scalar/ListIntContainer.swift +++ b/AmplifyTestCommon/Models/Scalar/ListIntContainer.swift @@ -24,7 +24,8 @@ public struct ListIntContainer: Model { 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 00d1f2b153..f9091501c8 100644 --- a/AmplifyTestCommon/Models/Scalar/ListStringContainer+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/ListStringContainer+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension ListStringContainer { +public extension ListStringContainer { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case test case nullableString @@ -21,10 +22,10 @@ extension ListStringContainer { case nullableStringNullableList } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let listStringContainer = ListStringContainer.keys model.listPluralName = "ListStringContainers" diff --git a/AmplifyTestCommon/Models/Scalar/ListStringContainer.swift b/AmplifyTestCommon/Models/Scalar/ListStringContainer.swift index 5a23f7a5de..d117df701c 100644 --- a/AmplifyTestCommon/Models/Scalar/ListStringContainer.swift +++ b/AmplifyTestCommon/Models/Scalar/ListStringContainer.swift @@ -24,7 +24,8 @@ public struct ListStringContainer: Model { 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 f1d85adce4..a71f0c2385 100644 --- a/AmplifyTestCommon/Models/Scalar/Nested+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/Nested+Schema.swift @@ -9,17 +9,18 @@ import Amplify import Foundation -extension Nested { +public extension Nested { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case valueOne case valueTwo } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let nested = Nested.keys model.listPluralName = "Nesteds" diff --git a/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel+Schema.swift b/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel+Schema.swift index 79f122f0ad..17b73bd87e 100644 --- a/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension NestedTypeTestModel { +public extension NestedTypeTestModel { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case nestedVal case nullableNestedVal @@ -21,10 +22,10 @@ extension NestedTypeTestModel { case nullableNestedNullableList } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let nestedTypeTestModel = NestedTypeTestModel.keys model.listPluralName = "NestedTypeTestModels" diff --git a/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel.swift b/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel.swift index 5ceda72443..31f881d908 100644 --- a/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel.swift +++ b/AmplifyTestCommon/Models/Scalar/NestedTypeTestModel.swift @@ -24,7 +24,8 @@ public struct NestedTypeTestModel: Model { 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/Scalar+Equatable.swift b/AmplifyTestCommon/Models/Scalar/Scalar+Equatable.swift index 3dff2379d4..d8ddc691cc 100644 --- a/AmplifyTestCommon/Models/Scalar/Scalar+Equatable.swift +++ b/AmplifyTestCommon/Models/Scalar/Scalar+Equatable.swift @@ -7,7 +7,7 @@ extension ScalarContainer: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.myInt == rhs.myInt && lhs.myDouble == rhs.myDouble && lhs.myBool == rhs.myBool @@ -19,60 +19,60 @@ extension ScalarContainer: Equatable { && lhs.myJSON == rhs.myJSON && lhs.myPhone == rhs.myPhone && lhs.myURL == rhs.myURL - && lhs.myIPAddress == rhs.myIPAddress) + && lhs.myIPAddress == rhs.myIPAddress } } extension ListIntContainer: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.test == rhs.test && lhs.nullableInt == rhs.nullableInt && lhs.intList == rhs.intList && lhs.intNullableList == rhs.intNullableList && lhs.nullableIntList == rhs.nullableIntList - && lhs.nullableIntNullableList == rhs.nullableIntNullableList) + && lhs.nullableIntNullableList == rhs.nullableIntNullableList } } extension ListStringContainer: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.test == rhs.test && lhs.nullableString == rhs.nullableString && lhs.stringList == rhs.stringList && lhs.stringNullableList == rhs.stringNullableList && lhs.nullableStringList == rhs.nullableStringList - && lhs.nullableStringNullableList == rhs.nullableStringNullableList) + && lhs.nullableStringNullableList == rhs.nullableStringNullableList } } extension EnumTestModel: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.enumVal == rhs.enumVal && lhs.nullableEnumVal == rhs.nullableEnumVal && lhs.enumList == rhs.enumList && lhs.enumNullableList == rhs.enumNullableList && lhs.nullableEnumList == rhs.nullableEnumList - && lhs.nullableEnumNullableList == rhs.nullableEnumNullableList) + && lhs.nullableEnumNullableList == rhs.nullableEnumNullableList } } extension NestedTypeTestModel: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.nestedVal == rhs.nestedVal && lhs.nullableNestedVal == rhs.nullableNestedVal && lhs.nestedList == rhs.nestedList && lhs.nestedNullableList == rhs.nestedNullableList && lhs.nullableNestedList == rhs.nullableNestedList - && lhs.nullableNestedNullableList == rhs.nullableNestedNullableList) + && lhs.nullableNestedNullableList == rhs.nullableNestedNullableList } } extension Nested: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.valueOne == rhs.valueOne - && lhs.valueTwo == rhs.valueTwo) + return lhs.valueOne == rhs.valueOne + && lhs.valueTwo == rhs.valueTwo } } diff --git a/AmplifyTestCommon/Models/Scalar/ScalarContainer+Schema.swift b/AmplifyTestCommon/Models/Scalar/ScalarContainer+Schema.swift index 8fc935838a..b34958a38a 100644 --- a/AmplifyTestCommon/Models/Scalar/ScalarContainer+Schema.swift +++ b/AmplifyTestCommon/Models/Scalar/ScalarContainer+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension ScalarContainer { +public extension ScalarContainer { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case myString case myInt @@ -28,10 +29,10 @@ extension ScalarContainer { case myIPAddress } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let scalarContainer = ScalarContainer.keys model.listPluralName = "ScalarContainers" diff --git a/AmplifyTestCommon/Models/Scalar/ScalarContainer.swift b/AmplifyTestCommon/Models/Scalar/ScalarContainer.swift index 17191db613..9f36c04ad4 100644 --- a/AmplifyTestCommon/Models/Scalar/ScalarContainer.swift +++ b/AmplifyTestCommon/Models/Scalar/ScalarContainer.swift @@ -38,7 +38,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 57d9581507..06bb69473d 100644 --- a/AmplifyTestCommon/Models/ScenarioATest6Post+Schema.swift +++ b/AmplifyTestCommon/Models/ScenarioATest6Post+Schema.swift @@ -9,17 +9,18 @@ import Amplify import Foundation -extension ScenarioATest6Post { +public extension ScenarioATest6Post { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let scenarioATest6Post = ScenarioATest6Post.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/ScenarioATest6Post.swift b/AmplifyTestCommon/Models/ScenarioATest6Post.swift index 108b4bfa0e..4840247b04 100644 --- a/AmplifyTestCommon/Models/ScenarioATest6Post.swift +++ b/AmplifyTestCommon/Models/ScenarioATest6Post.swift @@ -14,7 +14,8 @@ public struct ScenarioATest6Post: Model { public var title: String public init(id: String = UUID().uuidString, - title: String) { + 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 73c9190fdc..2f7f8b2ea2 100644 --- a/AmplifyTestCommon/Models/TeamProject/Project+Schema.swift +++ b/AmplifyTestCommon/Models/TeamProject/Project+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension Project { +public extension Project { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case team } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let project = Project.keys model.listPluralName = "Projects" diff --git a/AmplifyTestCommon/Models/TeamProject/Project.swift b/AmplifyTestCommon/Models/TeamProject/Project.swift index 14ae5d0559..4dc1c54b33 100644 --- a/AmplifyTestCommon/Models/TeamProject/Project.swift +++ b/AmplifyTestCommon/Models/TeamProject/Project.swift @@ -16,7 +16,8 @@ public struct Project: Model { 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 a9710d86f8..db2beb6552 100644 --- a/AmplifyTestCommon/Models/TeamProject/Team+Schema.swift +++ b/AmplifyTestCommon/Models/TeamProject/Team+Schema.swift @@ -9,17 +9,18 @@ import Amplify import Foundation -extension Team { +public extension Team { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let team = Team.keys model.listPluralName = "Teams" diff --git a/AmplifyTestCommon/Models/TeamProject/Team.swift b/AmplifyTestCommon/Models/TeamProject/Team.swift index 3ca4e7e2ef..579456315f 100644 --- a/AmplifyTestCommon/Models/TeamProject/Team.swift +++ b/AmplifyTestCommon/Models/TeamProject/Team.swift @@ -14,7 +14,8 @@ public struct Team: Model { public var name: String public init(id: String = UUID().uuidString, - name: String) { + 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 e51bfa5402..c176692ba9 100644 --- a/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Project1V2 { +public extension Project1V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case team @@ -20,10 +21,10 @@ extension Project1V2 { case project1V2TeamId } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let project1V2 = Project1V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2.swift b/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2.swift index 34440bbb51..e2f55e90f3 100644 --- a/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/1V2/Project1V2.swift @@ -20,7 +20,8 @@ public struct Project1V2: Model { public init(id: String = UUID().uuidString, name: String? = nil, team: Team1V2? = nil, - project1V2TeamId: String? = nil) { + project1V2TeamId: String? = nil) + { self.init(id: id, name: name, team: team, @@ -28,12 +29,13 @@ public struct Project1V2: Model { updatedAt: nil, project1V2TeamId: project1V2TeamId) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String? = nil, team: Team1V2? = nil, createdAt: Temporal.DateTime? = nil, updatedAt: Temporal.DateTime? = nil, - project1V2TeamId: String? = 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 8ed0f54ddf..d0e924104a 100644 --- a/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension Team1V2 { +public extension Team1V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let team1V2 = Team1V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2.swift b/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2.swift index ed29653b08..e27afbad48 100644 --- a/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/1V2/Team1V2.swift @@ -16,16 +16,18 @@ public struct Team1V2: Model { public var updatedAt: Temporal.DateTime? public init(id: String = UUID().uuidString, - name: String) { + name: String) + { self.init(id: id, name: name, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 286ca57848..9b641521ac 100644 --- a/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Project2V2 { +public extension Project2V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case teamID @@ -20,10 +21,10 @@ extension Project2V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let project2V2 = Project2V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2.swift b/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2.swift index fed160bd8c..f0059db9ff 100644 --- a/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/2V2/Project2V2.swift @@ -20,7 +20,8 @@ public struct Project2V2: Model { public init(id: String = UUID().uuidString, name: String? = nil, teamID: String, - team: Team2V2? = nil) { + team: Team2V2? = nil) + { self.init(id: id, name: name, teamID: teamID, @@ -28,12 +29,13 @@ public struct Project2V2: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String? = nil, teamID: String, team: Team2V2? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 43e0f11b00..62a80a8c70 100644 --- a/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension Team2V2 { +public extension Team2V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let team2V2 = Team2V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2.swift b/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2.swift index 7f13b3927a..27fa15fdcd 100644 --- a/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/2V2/Team2V2.swift @@ -16,16 +16,18 @@ public struct Team2V2: Model { public var updatedAt: Temporal.DateTime? public init(id: String = UUID().uuidString, - name: String) { + name: String) + { self.init(id: id, name: name, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 cee3850f92..0147d09715 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Comment3V2 { +public extension Comment3V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case postID case content @@ -19,10 +20,10 @@ extension Comment3V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment3V2 = Comment3V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2.swift b/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2.swift index 52f14a06fe..a02d7daca4 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3V2/Comment3V2.swift @@ -18,18 +18,20 @@ public struct Comment3V2: Model { public init(id: String = UUID().uuidString, postID: String, - content: String) { + content: String) + { self.init(id: id, postID: postID, content: content, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, postID: String, content: String, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 f377adf509..d31861d141 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Post3V2 { +public extension Post3V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case comments @@ -19,10 +20,10 @@ extension Post3V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post3V2 = Post3V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2.swift b/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2.swift index 365ff8bc83..c19dff9143 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3V2/Post3V2.swift @@ -18,18 +18,20 @@ public struct Post3V2: Model { public init(id: String = UUID().uuidString, title: String, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, comments: comments, createdAt: nil, updatedAt: nil) } - internal 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 diff --git a/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2+Schema.swift index 41081acbfc..0c5dec1f6d 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Comment3aV2 { +public extension Comment3aV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case createdAt @@ -19,10 +20,10 @@ extension Comment3aV2 { case post3aV2CommentsId } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment3aV2 = Comment3aV2.keys model.pluralName = "Comment3aV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2.swift b/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2.swift index 883bbd6eb8..94e1e4c6f1 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3aV2/Comment3aV2.swift @@ -18,18 +18,20 @@ public struct Comment3aV2: Model { public init(id: String = UUID().uuidString, content: String, - post3aV2CommentsId: String? = nil) { + post3aV2CommentsId: String? = nil) + { self.init(id: id, content: content, createdAt: nil, updatedAt: nil, post3aV2CommentsId: post3aV2CommentsId) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String, createdAt: Temporal.DateTime? = nil, updatedAt: Temporal.DateTime? = nil, - post3aV2CommentsId: String? = 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 3b33c9960e..6721f2b9ae 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Post3aV2 { +public extension Post3aV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case comments @@ -19,10 +20,10 @@ extension Post3aV2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post3aV2 = Post3aV2.keys model.pluralName = "Post3aV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2.swift b/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2.swift index 5332fcf81a..1a1fb9ba46 100644 --- a/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/3aV2/Post3aV2.swift @@ -18,18 +18,20 @@ public struct Post3aV2: Model { public init(id: String = UUID().uuidString, title: String, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, comments: comments, createdAt: nil, updatedAt: nil) } - internal 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 diff --git a/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2+Schema.swift index db568413b1..3aa2fdfcf5 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Comment4V2 { +public extension Comment4V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case post @@ -19,10 +20,10 @@ extension Comment4V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment4V2 = Comment4V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2.swift b/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2.swift index 5873d993e4..b8f5ffe8b3 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4V2/Comment4V2.swift @@ -18,18 +18,20 @@ public struct Comment4V2: Model { public init(id: String = UUID().uuidString, content: String, - post: Post4V2? = nil) { + post: Post4V2? = nil) + { self.init(id: id, content: content, post: post, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String, post: Post4V2? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 c0fa5fdfbb..a57605845f 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Post4V2 { +public extension Post4V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case comments @@ -19,10 +20,10 @@ extension Post4V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post4V2 = Post4V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2.swift b/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2.swift index 7978edceb7..2fa77c850a 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4V2/Post4V2.swift @@ -18,18 +18,20 @@ public struct Post4V2: Model { public init(id: String = UUID().uuidString, title: String, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, comments: comments, createdAt: nil, updatedAt: nil) } - internal 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 diff --git a/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2+Schema.swift index 5142fd05de..16bd6f6c5f 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Project4aV2 { +public extension Project4aV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case team @@ -20,10 +21,10 @@ extension Project4aV2 { case project4aV2TeamId } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let project4aV2 = Project4aV2.keys model.pluralName = "Project4aV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2.swift b/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2.swift index 51b873975c..addfb388c5 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4aV2/Project4aV2.swift @@ -24,7 +24,8 @@ public class Project4aV2: Model { public convenience init(id: String = UUID().uuidString, name: String? = nil, team: Team4aV2? = nil, - project4aV2TeamId: String? = nil) { + project4aV2TeamId: String? = nil) + { self.init(id: id, name: name, team: team, @@ -32,12 +33,13 @@ public class Project4aV2: Model { updatedAt: nil, project4aV2TeamId: project4aV2TeamId) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String? = nil, team: Team4aV2? = nil, createdAt: Temporal.DateTime? = nil, updatedAt: Temporal.DateTime? = nil, - project4aV2TeamId: String? = 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 9b7cae724e..885bad3b8c 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Team4aV2 { +public extension Team4aV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case project @@ -19,10 +20,10 @@ extension Team4aV2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let team4aV2 = Team4aV2.keys model.pluralName = "Team4aV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2.swift b/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2.swift index 71d880f56b..02a95f6e57 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4aV2/Team4aV2.swift @@ -18,18 +18,20 @@ public class Team4aV2: Model { public convenience init(id: String = UUID().uuidString, name: String, - project: Project4aV2? = nil) { + project: Project4aV2? = nil) + { self.init(id: id, name: name, project: project, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, project: Project4aV2? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 236d2be094..19aa0120c8 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Project4bV2 { +public extension Project4bV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case team @@ -20,10 +21,10 @@ extension Project4bV2 { case project4bV2TeamId } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let project4bV2 = Project4bV2.keys model.pluralName = "Project4bV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2.swift b/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2.swift index 2369a6c57b..d450fe8f49 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4bV2/Project4bV2.swift @@ -20,7 +20,8 @@ public class Project4bV2: Model { public convenience init(id: String = UUID().uuidString, name: String? = nil, team: Team4bV2? = nil, - project4bV2TeamId: String? = nil) { + project4bV2TeamId: String? = nil) + { self.init(id: id, name: name, team: team, @@ -28,12 +29,13 @@ public class Project4bV2: Model { updatedAt: nil, project4bV2TeamId: project4bV2TeamId) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String? = nil, team: Team4bV2? = nil, createdAt: Temporal.DateTime? = nil, updatedAt: Temporal.DateTime? = nil, - project4bV2TeamId: String? = 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 311044fad2..f4ba216f51 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Team4bV2 { +public extension Team4bV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case project @@ -19,10 +20,10 @@ extension Team4bV2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let team4bV2 = Team4bV2.keys model.pluralName = "Team4bV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2.swift b/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2.swift index 644c856c81..7e7e71ac63 100644 --- a/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/4bV2/Team4bV2.swift @@ -18,18 +18,20 @@ public class Team4bV2: Model { public convenience init(id: String = UUID().uuidString, name: String, - project: Project4bV2? = nil) { + project: Project4bV2? = nil) + { self.init(id: id, name: name, project: project, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, project: Project4bV2? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 84a32e2cb8..1b6544ed3b 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Post5V2 { +public extension Post5V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case editors @@ -19,10 +20,10 @@ extension Post5V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post5V2 = Post5V2.keys model.pluralName = "Post5V2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2.swift b/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2.swift index 3165ee7f99..bdcd0fedec 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/Post5V2.swift @@ -18,18 +18,20 @@ public struct Post5V2: Model { public init(id: String = UUID().uuidString, title: String, - editors: List? = []) { + editors: List? = []) + { self.init(id: id, title: title, editors: editors, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, title: String, editors: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 cdbcd3e07d..5a0d9ded03 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension PostEditor5V2 { +public extension PostEditor5V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case post5V2 case user5V2 @@ -19,10 +20,10 @@ extension PostEditor5V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let postEditor5V2 = PostEditor5V2.keys model.pluralName = "PostEditor5V2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2.swift b/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2.swift index f78bbe9420..765f90e5b2 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/PostEditor5V2.swift @@ -18,18 +18,20 @@ public struct PostEditor5V2: Model { public init(id: String = UUID().uuidString, post5V2: Post5V2, - user5V2: User5V2) { + user5V2: User5V2) + { self.init(id: id, post5V2: post5V2, user5V2: user5V2, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, post5V2: Post5V2, user5V2: User5V2, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 5c35bd5ad9..fa1c0b4ce8 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension User5V2 { +public extension User5V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case username case posts @@ -19,10 +20,10 @@ extension User5V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let user5V2 = User5V2.keys model.pluralName = "User5V2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2.swift b/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2.swift index 7329a37803..edd9f0f46e 100644 --- a/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/5V2/User5V2.swift @@ -18,18 +18,20 @@ public struct User5V2: Model { public init(id: String = UUID().uuidString, username: String, - posts: List? = []) { + posts: List? = []) + { self.init(id: id, username: username, posts: posts, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, username: String, posts: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 0c2d801a88..3148e6d426 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Blog6V2 { +public extension Blog6V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case posts @@ -19,10 +20,10 @@ extension Blog6V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let blog6V2 = Blog6V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2.swift b/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2.swift index 1d1c62c34c..373b088c1d 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Blog6V2.swift @@ -18,18 +18,20 @@ public struct Blog6V2: Model { public init(id: String = UUID().uuidString, name: String, - posts: List? = []) { + posts: List? = []) + { self.init(id: id, name: name, posts: posts, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, posts: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 2d8fe7959c..1e3e80dff5 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Comment6V2 { +public extension Comment6V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case post case content @@ -19,10 +20,10 @@ extension Comment6V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment6V2 = Comment6V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2.swift b/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2.swift index f975f70fb2..de69bee639 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Comment6V2.swift @@ -18,18 +18,20 @@ public struct Comment6V2: Model { public init(id: String = UUID().uuidString, post: Post6V2? = nil, - content: String) { + content: String) + { self.init(id: id, post: post, content: content, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, post: Post6V2? = nil, content: String, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 5e96bf8cd9..880bda766c 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Post6V2 { +public extension Post6V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case blog @@ -20,10 +21,10 @@ extension Post6V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post6V2 = Post6V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2.swift b/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2.swift index bebe11af46..256914cf56 100644 --- a/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/6V2/Post6V2.swift @@ -20,7 +20,8 @@ public struct Post6V2: Model { public init(id: String = UUID().uuidString, title: String, blog: Blog6V2? = nil, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, blog: blog, @@ -28,12 +29,13 @@ public struct Post6V2: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, title: String, blog: Blog6V2? = nil, comments: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 84fa41ace3..83a88a0966 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Blog7V2 { +public extension Blog7V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case posts @@ -19,10 +20,10 @@ extension Blog7V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let blog7V2 = Blog7V2.keys model.pluralName = "Blog7V2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2.swift b/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2.swift index e963392ee5..b05ee7a517 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Blog7V2.swift @@ -18,18 +18,20 @@ public struct Blog7V2: Model { public init(id: String = UUID().uuidString, name: String, - posts: List? = []) { + posts: List? = []) + { self.init(id: id, name: name, posts: posts, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, posts: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 0f71ceb037..a18e97f569 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Comment7V2 { +public extension Comment7V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case post @@ -19,10 +20,10 @@ extension Comment7V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment7V2 = Comment7V2.keys model.pluralName = "Comment7V2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2.swift b/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2.swift index 317bef7b62..abf10ebea1 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Comment7V2.swift @@ -18,18 +18,20 @@ public struct Comment7V2: Model { public init(id: String = UUID().uuidString, content: String? = nil, - post: Post7V2? = nil) { + post: Post7V2? = nil) + { self.init(id: id, content: content, post: post, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String? = nil, post: Post7V2? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 e16552145c..aa64967940 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Post7V2 { +public extension Post7V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case blog @@ -20,10 +21,10 @@ extension Post7V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post7V2 = Post7V2.keys model.pluralName = "Post7V2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2.swift b/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2.swift index a1cb3dfb84..9f67e96ad8 100644 --- a/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/7V2/Post7V2.swift @@ -20,7 +20,8 @@ public struct Post7V2: Model { public init(id: String = UUID().uuidString, title: String, blog: Blog7V2? = nil, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, blog: blog, @@ -28,12 +29,13 @@ public struct Post7V2: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, title: String, blog: Blog7V2? = nil, comments: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 d77a61d5ee..e5a0c0ee24 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension Attendee8V2 { +public extension Attendee8V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case meetings case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let attendee8V2 = Attendee8V2.keys model.pluralName = "Attendee8V2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2.swift b/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2.swift index bdb90d7726..7ab964caec 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Attendee8V2.swift @@ -16,16 +16,18 @@ public struct Attendee8V2: Model { public var updatedAt: Temporal.DateTime? public init(id: String = UUID().uuidString, - meetings: List? = []) { + meetings: List? = []) + { self.init(id: id, meetings: meetings, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, meetings: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 ea734e16d1..046b049a38 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Meeting8V2 { +public extension Meeting8V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case attendees @@ -19,10 +20,10 @@ extension Meeting8V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let meeting8V2 = Meeting8V2.keys model.pluralName = "Meeting8V2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2.swift b/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2.swift index 84abbbdd0c..bfe69260d9 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Meeting8V2.swift @@ -18,18 +18,20 @@ public struct Meeting8V2: Model { public init(id: String = UUID().uuidString, title: String, - attendees: List? = []) { + attendees: List? = []) + { self.init(id: id, title: title, attendees: attendees, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, title: String, attendees: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 72355ba4ea..9dbcdd4946 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Registration8V2 { +public extension Registration8V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case meeting case attendee @@ -19,10 +20,10 @@ extension Registration8V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let registration8V2 = Registration8V2.keys model.pluralName = "Registration8V2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2.swift b/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2.swift index f9d2aa3b4b..90b2fc5000 100644 --- a/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/8V2/Registration8V2.swift @@ -18,18 +18,20 @@ public struct Registration8V2: Model { public init(id: String = UUID().uuidString, meeting: Meeting8V2, - attendee: Attendee8V2) { + attendee: Attendee8V2) + { self.init(id: id, meeting: meeting, attendee: attendee, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, meeting: Meeting8V2, attendee: Attendee8V2, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 f760ef2c9c..85a7f33720 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension CustomerMultipleSecondaryIndexV2 { +public extension CustomerMultipleSecondaryIndexV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case phoneNumber @@ -21,10 +22,10 @@ extension CustomerMultipleSecondaryIndexV2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let customerMultipleSecondaryIndexV2 = CustomerMultipleSecondaryIndexV2.keys model.pluralName = "CustomerMultipleSecondaryIndexV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2.swift b/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2.swift index 7e92f12052..03ac7eb5a1 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerMultipleSecondaryIndexV2.swift @@ -22,7 +22,8 @@ public struct CustomerMultipleSecondaryIndexV2: Model { name: String, phoneNumber: String? = nil, age: Int, - accountRepresentativeID: String) { + accountRepresentativeID: String) + { self.init(id: id, name: name, phoneNumber: phoneNumber, @@ -31,13 +32,14 @@ public struct CustomerMultipleSecondaryIndexV2: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, phoneNumber: String? = nil, age: Int, accountRepresentativeID: String, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 3058f7d566..242ec40537 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension CustomerSecondaryIndexV2 { +public extension CustomerSecondaryIndexV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case phoneNumber @@ -20,10 +21,10 @@ extension CustomerSecondaryIndexV2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let customerSecondaryIndexV2 = CustomerSecondaryIndexV2.keys model.pluralName = "CustomerSecondaryIndexV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2.swift b/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2.swift index e6e0d76c04..4559a9ebd9 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerSecondaryIndexV2.swift @@ -20,7 +20,8 @@ public struct CustomerSecondaryIndexV2: Model { public init(id: String = UUID().uuidString, name: String, phoneNumber: String? = nil, - accountRepresentativeID: String) { + accountRepresentativeID: String) + { self.init(id: id, name: name, phoneNumber: phoneNumber, @@ -28,12 +29,13 @@ public struct CustomerSecondaryIndexV2: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, phoneNumber: String? = nil, accountRepresentativeID: String, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 40e8c0f7ce..9c9ea1472e 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension CustomerWithMultipleFieldsinPK { +public extension CustomerWithMultipleFieldsinPK { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case dob case date @@ -25,10 +26,10 @@ extension CustomerWithMultipleFieldsinPK { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let customerWithMultipleFieldsinPK = CustomerWithMultipleFieldsinPK.keys model.pluralName = "CustomerWithMultipleFieldsinPKs" diff --git a/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK.swift b/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK.swift index 32293d9975..b39698705c 100644 --- a/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK.swift +++ b/AmplifyTestCommon/Models/TransformerV2/CustomerWithMultipleFieldsinPK.swift @@ -30,7 +30,8 @@ public struct CustomerWithMultipleFieldsinPK: Model { priority: Priority, height: Double, firstName: String? = nil, - lastName: String? = nil) { + lastName: String? = nil) + { self.init(id: id, dob: dob, date: date, @@ -43,7 +44,7 @@ public struct CustomerWithMultipleFieldsinPK: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, dob: Temporal.DateTime, date: Temporal.Date, time: Temporal.Time, @@ -53,7 +54,8 @@ public struct CustomerWithMultipleFieldsinPK: Model { firstName: String? = nil, lastName: String? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 03ace0efac..3b3ee37886 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Blog8 { +public extension Blog8 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case customs @@ -21,10 +22,10 @@ extension Blog8 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let blog8 = Blog8.keys model.pluralName = "Blog8s" diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8.swift index 92c1ccae48..5cd5a006ef 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Blog8.swift @@ -22,7 +22,8 @@ public struct Blog8: Model { name: String, customs: [MyCustomModel8?]? = nil, notes: [String?]? = nil, - posts: List? = []) { + posts: List? = []) + { self.init(id: id, name: name, customs: customs, @@ -31,13 +32,14 @@ public struct Blog8: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, customs: [MyCustomModel8?]? = nil, notes: [String?]? = nil, posts: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 6258c76ca6..2ed6d20988 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Comment8 { +public extension Comment8 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case post @@ -19,10 +20,10 @@ extension Comment8 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment8 = Comment8.keys model.pluralName = "Comment8s" diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8.swift index 4a0042140e..cb271b760d 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Comment8.swift @@ -18,18 +18,20 @@ public struct Comment8: Model { public init(id: String = UUID().uuidString, content: String? = nil, - post: Post8? = nil) { + post: Post8? = nil) + { self.init(id: id, content: content, post: post, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String? = nil, post: Post8? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 27f611af59..22fd73073d 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyCustomModel8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyCustomModel8+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension MyCustomModel8 { +public extension MyCustomModel8 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case desc case children } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let myCustomModel8 = MyCustomModel8.keys model.pluralName = "MyCustomModel8s" diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyNestedModel8+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyNestedModel8+Schema.swift index 1d18ede96f..ecc52ed477 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyNestedModel8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/MyNestedModel8+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension MyNestedModel8 { +public extension MyNestedModel8 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case nestedName case notes } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let myNestedModel8 = MyNestedModel8.keys model.pluralName = "MyNestedModel8s" diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8+Schema.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8+Schema.swift index bd21917eb4..81d5941efa 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8+Schema.swift @@ -9,9 +9,10 @@ import Amplify import Foundation -extension Post8 { +public extension Post8 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case randomId @@ -21,10 +22,10 @@ extension Post8 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post8 = Post8.keys model.pluralName = "Post8s" diff --git a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8.swift b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8.swift index 306eb3395b..051588fcd2 100644 --- a/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8.swift +++ b/AmplifyTestCommon/Models/TransformerV2/OptionalAssociations/Post8.swift @@ -22,7 +22,8 @@ public struct Post8: Model { name: String, randomId: String? = nil, blog: Blog8? = nil, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, name: name, randomId: randomId, @@ -31,13 +32,14 @@ public struct Post8: Model { createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, name: String, randomId: String? = nil, blog: Blog8? = nil, comments: List? = [], createdAt: Temporal.DateTime? = nil, - updatedAt: 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 5d527c5bdf..5327762f2b 100644 --- a/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension SchemaDrift { +public extension SchemaDrift { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case enumValue case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let schemaDrift = SchemaDrift.keys model.pluralName = "SchemaDrifts" diff --git a/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift.swift b/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift.swift index dfac48fda6..af60370ec6 100644 --- a/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift.swift +++ b/AmplifyTestCommon/Models/TransformerV2/SchemaDrift/SchemaDrift.swift @@ -31,16 +31,18 @@ public struct SchemaDrift: Model { public var updatedAt: Temporal.DateTime? public init(id: String = UUID().uuidString, - enumValue: EnumDrift? = nil) { + enumValue: EnumDrift? = nil) + { self.init(id: id, enumValue: enumValue, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, enumValue: EnumDrift? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 716f4848fe..5023d196b6 100644 --- a/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension TodoCustomTimestampV2 { +public extension TodoCustomTimestampV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case createdOn case updatedOn } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let todoCustomTimestampV2 = TodoCustomTimestampV2.keys model.pluralName = "TodoCustomTimestampV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2.swift b/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2.swift index 4bad844e17..ae64563c1b 100644 --- a/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/TodoCustomTimestampV2.swift @@ -16,16 +16,18 @@ public struct TodoCustomTimestampV2: Model { public var updatedOn: Temporal.DateTime? public init(id: String = UUID().uuidString, - content: String? = nil) { + content: String? = nil) + { self.init(id: id, content: content, createdOn: nil, updatedOn: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String? = nil, createdOn: Temporal.DateTime? = nil, - updatedOn: 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 6de5d45ae2..e60bd05c2c 100644 --- a/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2+Schema.swift +++ b/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension TodoWithDefaultValueV2 { +public extension TodoWithDefaultValueV2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case createdAt case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let todoWithDefaultValueV2 = TodoWithDefaultValueV2.keys model.pluralName = "TodoWithDefaultValueV2s" diff --git a/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2.swift b/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2.swift index dd622e15fc..363c553046 100644 --- a/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2.swift +++ b/AmplifyTestCommon/Models/TransformerV2/TodoWithDefaultValueV2.swift @@ -16,16 +16,18 @@ public struct TodoWithDefaultValueV2: Model { public var updatedAt: Temporal.DateTime? public init(id: String = UUID().uuidString, - content: String? = nil) { + content: String? = nil) + { self.init(id: id, content: content, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: 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 a085ba40a2..3676cc0d31 100644 --- a/AmplifyTestCommon/Models/User+Schema.swift +++ b/AmplifyTestCommon/Models/User+Schema.swift @@ -9,19 +9,20 @@ import Amplify import Foundation -extension User { +public extension User { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case name case following case followers } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let user = User.keys model.listPluralName = "Users" @@ -34,10 +35,10 @@ extension User { .hasMany(user.followers, is: .optional, ofType: UserFollowers.self, associatedWith: UserFollowers.keys.user) ) } - - public class Path: ModelPath {} - - public static var rootPath: PropertyContainerPath? { Path() } + + class Path: ModelPath {} + + static var rootPath: PropertyContainerPath? { Path() } } extension ModelPath where ModelType == User { @@ -45,6 +46,6 @@ extension ModelPath where ModelType == User { var name: FieldPath { string("name") } var following: ModelPath { UserFollowing.Path(name: "following", isCollection: true, parent: self) } var followers: ModelPath { UserFollowers.Path(name: "followers", isCollection: true, parent: self) } - + } diff --git a/AmplifyTestCommon/Models/User.swift b/AmplifyTestCommon/Models/User.swift index e3bf9a2bb1..d34069fcb8 100644 --- a/AmplifyTestCommon/Models/User.swift +++ b/AmplifyTestCommon/Models/User.swift @@ -18,7 +18,8 @@ public struct User: Model { 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 d582041f43..03f2999394 100644 --- a/AmplifyTestCommon/Models/UserFollowers+Schema.swift +++ b/AmplifyTestCommon/Models/UserFollowers+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension UserFollowers { +public extension UserFollowers { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case user case followersUser } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let userFollowers = UserFollowers.keys model.listPluralName = "UserFollowers" @@ -32,10 +33,10 @@ extension UserFollowers { .belongsTo(userFollowers.followersUser, is: .optional, ofType: User.self, targetName: "userFollowersFollowersUserId") ) } - - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension ModelPath where ModelType == UserFollowers { diff --git a/AmplifyTestCommon/Models/UserFollowers.swift b/AmplifyTestCommon/Models/UserFollowers.swift index 5c2f851f90..03cae97240 100644 --- a/AmplifyTestCommon/Models/UserFollowers.swift +++ b/AmplifyTestCommon/Models/UserFollowers.swift @@ -16,7 +16,8 @@ public struct UserFollowers: Model { 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 5b7919b96c..37d9ac8151 100644 --- a/AmplifyTestCommon/Models/UserFollowing+Schema.swift +++ b/AmplifyTestCommon/Models/UserFollowing+Schema.swift @@ -9,18 +9,19 @@ import Amplify import Foundation -extension UserFollowing { +public extension UserFollowing { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case user case followingUser } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let userFollowing = UserFollowing.keys model.listPluralName = "UserFollowings" @@ -32,10 +33,10 @@ extension UserFollowing { .belongsTo(userFollowing.followingUser, is: .optional, ofType: User.self, targetName: "userFollowingFollowingUserId") ) } - - public class Path: ModelPath {} - - public static var rootPath: PropertyContainerPath? { Path() } + + class Path: ModelPath {} + + static var rootPath: PropertyContainerPath? { Path() } } extension ModelPath where ModelType == UserFollowing { diff --git a/AmplifyTestCommon/Models/UserFollowing.swift b/AmplifyTestCommon/Models/UserFollowing.swift index a545803ac3..73d450926b 100644 --- a/AmplifyTestCommon/Models/UserFollowing.swift +++ b/AmplifyTestCommon/Models/UserFollowing.swift @@ -16,7 +16,8 @@ public struct UserFollowing: Model { 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 2404d3373b..5b7eebd08d 100644 --- a/AmplifyTestCommon/SharedTestCases/SharedTestCasesPostComment4V2.swift +++ b/AmplifyTestCommon/SharedTestCases/SharedTestCasesPostComment4V2.swift @@ -24,21 +24,21 @@ import Foundation */ protocol SharedTestCasesPostComment4V2 { - + func testSaveCommentThenQueryComment() async throws - + func testSavePostThenQueryPost() async throws - + func testSaveMultipleThenQueryComments() async throws - + func testSaveMultipleThenQueryPosts() async throws - + func testSaveCommentWithPostThenQueryCommentAndAccessPost() async throws - + func testSaveCommentWithPostThenQueryPostAndAccessComments() async throws - + func testSaveMultipleCommentWithPostThenQueryCommentsAndAccessPost() async throws - + func testSaveMultipleCommentWithPostThenQueryPostAndAccessComments() async throws } @@ -50,21 +50,23 @@ public struct LazyParentPost4V2: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - + public init(id: String = UUID().uuidString, title: String, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, comments: comments, createdAt: nil, updatedAt: nil) } - internal 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 @@ -72,28 +74,28 @@ public struct LazyParentPost4V2: Model { self.updatedAt = updatedAt } } -extension LazyParentPost4V2 { +public extension LazyParentPost4V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let post4V2 = Post4V2.keys - + model.authRules = [ rule(allow: .public, operations: [.create, .update, .delete, .read]) ] - + model.pluralName = "LazyParentPost4V2s" - + model.fields( .id(), .field(post4V2.title, is: .required, ofType: .string), @@ -107,7 +109,7 @@ extension LazyParentPost4V2 { public struct LazyChildComment4V2: Model { public let id: String public var content: String - internal var _post: LazyReference + var _post: LazyReference public var post: LazyParentPost4V2? { get async throws { try await _post.get() @@ -115,41 +117,43 @@ 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) { + post: LazyParentPost4V2? = nil) + { self.init(id: id, content: content, post: post, createdAt: nil, updatedAt: nil) } - internal init(id: String = UUID().uuidString, + init(id: String = UUID().uuidString, content: String, post: LazyParentPost4V2? = nil, createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + updatedAt: Temporal.DateTime? = nil) + { self.id = id self.content = content self._post = LazyReference(post) self.createdAt = createdAt self.updatedAt = updatedAt } - + public mutating func setPost(_ post: LazyParentPost4V2) { - self._post = LazyReference(post) + _post = LazyReference(post) } - + public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try values.decode(String.self, forKey: .content) - _post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.content = try values.decode(String.self, forKey: .content) + self._post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } - + public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) @@ -160,32 +164,32 @@ public struct LazyChildComment4V2: Model { } } -extension LazyChildComment4V2 { +public extension LazyChildComment4V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case content case post case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let comment4V2 = Comment4V2.keys - + model.authRules = [ rule(allow: .public, operations: [.create, .update, .delete, .read]) ] - + model.pluralName = "LazyChildComment4V2s" - + model.attributes( .index(fields: ["postID", "content"], name: "byPost4") ) - + model.fields( .id(), .field(comment4V2.content, is: .required, ofType: .string), @@ -207,18 +211,20 @@ public struct ParentPost4V2: Model { public init(id: String = UUID().uuidString, title: String, - comments: List? = []) { + comments: List? = []) + { self.init(id: id, title: title, comments: comments, createdAt: nil, updatedAt: nil) } - internal 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 @@ -226,9 +232,10 @@ public struct ParentPost4V2: Model { self.updatedAt = updatedAt } } -extension ParentPost4V2 { +public extension ParentPost4V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case title case comments @@ -236,10 +243,10 @@ extension ParentPost4V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let post4V2 = Post4V2.keys model.authRules = [ @@ -267,18 +274,20 @@ public struct ChildComment4V2: Model { public init(id: String = UUID().uuidString, content: String, - post: ParentPost4V2? = nil) { + post: ParentPost4V2? = nil) + { self.init(id: id, content: content, post: post, createdAt: nil, updatedAt: nil) } - internal 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 @@ -287,9 +296,10 @@ public struct ChildComment4V2: Model { } } -extension ChildComment4V2 { +public extension ChildComment4V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey + { case id case content case post @@ -297,10 +307,10 @@ extension ChildComment4V2 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let comment4V2 = Comment4V2.keys model.authRules = [ diff --git a/AmplifyTestCommon/TestCommonConstants.swift b/AmplifyTestCommon/TestCommonConstants.swift index 3f0128987b..7abbade9bd 100644 --- a/AmplifyTestCommon/TestCommonConstants.swift +++ b/AmplifyTestCommon/TestCommonConstants.swift @@ -6,6 +6,7 @@ // import Foundation + class TestCommonConstants { static let networkTimeout = TimeInterval(10) } diff --git a/AmplifyTests/CategoryTests/API/APICategoryClientGraphQLTests.swift b/AmplifyTests/CategoryTests/API/APICategoryClientGraphQLTests.swift index 09a85d35ab..0c6619a20a 100644 --- a/AmplifyTests/CategoryTests/API/APICategoryClientGraphQLTests.swift +++ b/AmplifyTests/CategoryTests/API/APICategoryClientGraphQLTests.swift @@ -55,7 +55,7 @@ class APICategoryClientGraphQLTests: XCTestCase { } let request = GraphQLRequest(document: "", variables: nil, responseType: JSONValue.self) - + let mutateCompleted = expectation(description: "mutate completed") Task { _ = try await Amplify.API.mutate(request: request) diff --git a/AmplifyTests/CategoryTests/API/APICategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/API/APICategoryConfigurationTests.swift index 56ea2b9c39..09dd5074dc 100644 --- a/AmplifyTests/CategoryTests/API/APICategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/API/APICategoryConfigurationTests.swift @@ -100,7 +100,8 @@ 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 + "Getting a plugin after reset() should throw") + { error in guard case APIError.invalidConfiguration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -213,7 +214,7 @@ class APICategoryConfigurationTests: XCTestCase { let amplifyConfig = AmplifyConfiguration(api: apiConfig) try Amplify.configure(amplifyConfig) - + let getCompleted = expectation(description: "get completed") Task { let plugin = try Amplify.API.getPlugin(for: "MockSecondAPICategoryPlugin") @@ -287,7 +288,8 @@ 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 + "configure() an already configured plugin should throw") + { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -396,7 +398,8 @@ class APICategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") { error in + "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/API/NondeterminsticOperationTests.swift b/AmplifyTests/CategoryTests/API/NondeterminsticOperationTests.swift index 2923117710..889b8723cb 100644 --- a/AmplifyTests/CategoryTests/API/NondeterminsticOperationTests.swift +++ b/AmplifyTests/CategoryTests/API/NondeterminsticOperationTests.swift @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // - import XCTest @testable import Amplify diff --git a/AmplifyTests/CategoryTests/API/RetryableGraphQLOperationTests.swift b/AmplifyTests/CategoryTests/API/RetryableGraphQLOperationTests.swift index a9e374f9e8..b424a6cb34 100644 --- a/AmplifyTests/CategoryTests/API/RetryableGraphQLOperationTests.swift +++ b/AmplifyTests/CategoryTests/API/RetryableGraphQLOperationTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import Combine import Foundation import XCTest -import Combine @testable import Amplify @testable import AmplifyTestCommon diff --git a/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryClientAPITests.swift b/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryClientAPITests.swift index 9e1d8c8044..9c7f45c22d 100644 --- a/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryClientAPITests.swift +++ b/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryClientAPITests.swift @@ -107,7 +107,7 @@ class AnalyticsCategoryClientAPITests: XCTestCase { analytics.unregisterGlobalProperties("one", "two") await fulfillment(of: [methodInvoked], timeout: 1) } - + func testUnregisterGlobalPropertiesWithArrayParameter() async throws { let expectedMessage = "unregisterGlobalProperties(_:)" let methodInvoked = expectation(description: "Expected method was invoked on plugin") diff --git a/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryConfigurationTests.swift index b4eaef7b6b..a32dc464ab 100644 --- a/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Analytics/AnalyticsCategoryConfigurationTests.swift @@ -99,7 +99,8 @@ 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 + "Getting a plugin after reset() should throw") + { error in guard case AnalyticsError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -261,7 +262,8 @@ 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 + "configure() an already configured plugin should throw") + { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -338,7 +340,8 @@ class AnalyticsCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") { error in + "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 8cb62497d4..735f96733b 100644 --- a/AmplifyTests/CategoryTests/Auth/AuthCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Auth/AuthCategoryConfigurationTests.swift @@ -64,7 +64,7 @@ class AuthCategoryConfigurationTests: XCTestCase { func testCanConfigureCategoryWithAmplifyOutputs() throws { let plugin = MockAuthCategoryPlugin() try Amplify.add(plugin: plugin) - + let config = AmplifyOutputsData() try Amplify.configure(config) @@ -122,7 +122,8 @@ 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 + "Getting a plugin after reset() should throw") + { error in guard case AuthError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -337,7 +338,8 @@ 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 + "configure() an already configured plugin should throw") + { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -446,7 +448,8 @@ class AuthCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") { error in + "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 18d4014d56..db970275df 100644 --- a/AmplifyTests/CategoryTests/DataStore/DataStoreCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/DataStoreCategoryConfigurationTests.swift @@ -106,7 +106,8 @@ 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 + "Getting a plugin after reset() should throw") + { error in guard case DataStoreError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -221,7 +222,7 @@ class DataStoreCategoryConfigurationTests: XCTestCase { let amplifyConfig = AmplifyConfiguration(dataStore: dataStoreConfig) try Amplify.configure(amplifyConfig) - + let saveSuccess = expectation(description: "save success") Task { _ = try await Amplify.DataStore.getPlugin(for: "MockSecondDataStoreCategoryPlugin") @@ -295,7 +296,8 @@ 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 + "configure() an already configured plugin should throw") + { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -372,7 +374,8 @@ class DataStoreCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") { error in + "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 7fdd8ce982..fb370aa63c 100644 --- a/AmplifyTests/CategoryTests/DataStore/JSONValueHolderTest.swift +++ b/AmplifyTests/CategoryTests/DataStore/JSONValueHolderTest.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest class JSONValueHolderTest: XCTestCase { @@ -66,7 +66,8 @@ 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/Collection/ArrayLiteralListProviderTests.swift b/AmplifyTests/CategoryTests/DataStore/Model/Collection/ArrayLiteralListProviderTests.swift index 70835d17d1..78b9a399d7 100644 --- a/AmplifyTests/CategoryTests/DataStore/Model/Collection/ArrayLiteralListProviderTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/Model/Collection/ArrayLiteralListProviderTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest class ArrayLiteralListProviderTests: XCTestCase { struct BasicModel: Model { @@ -42,7 +42,7 @@ class ArrayLiteralListProviderTests: XCTestCase { wait(for: [loadComplete], timeout: 1) } - + func testLoadAsync() async throws { let provider = ArrayLiteralListProvider(elements: [BasicModel(id: "id")]) let elements = try await provider.load() @@ -73,7 +73,7 @@ class ArrayLiteralListProviderTests: XCTestCase { wait(for: [getNextPageComplete], timeout: 1) } - + func testGetNextPageAsync() async { let provider = ArrayLiteralListProvider(elements: [BasicModel(id: "id")]) do { diff --git a/AmplifyTests/CategoryTests/DataStore/Model/LazyReferenceTests.swift b/AmplifyTests/CategoryTests/DataStore/Model/LazyReferenceTests.swift index 16ea4fc54a..21005b4b4e 100644 --- a/AmplifyTests/CategoryTests/DataStore/Model/LazyReferenceTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/Model/LazyReferenceTests.swift @@ -10,28 +10,28 @@ import XCTest @testable import AmplifyTestCommon final class LazyReferenceTests: XCTestCase { - + override func setUp() { ModelRegistry.register(modelType: LazyParentPost4V2.self) ModelRegistry.register(modelType: LazyChildComment4V2.self) } - + class MockModelProvider: ModelProvider { enum LoadedState { case notLoaded(identifiers: [LazyReferenceIdentifier]?) case loaded(model: ModelType?) } - + var loadedState: LoadedState - + init(loadedState: LoadedState) { self.loadedState = loadedState } - + func load() async throws -> Element? { return nil } - + func getState() -> ModelProviderState { switch loadedState { case .notLoaded(let identifiers): @@ -40,7 +40,7 @@ final class LazyReferenceTests: XCTestCase { return .loaded(model: model) } } - + func encode(to encoder: Encoder) throws { switch loadedState { case .notLoaded(let identifiers): @@ -51,7 +51,7 @@ final class LazyReferenceTests: XCTestCase { } } } - + func testEncodeDecodeLoaded() throws { let post = LazyParentPost4V2(id: "postId", title: "t") let comment = LazyChildComment4V2(id: "commentId", content: "c", post: post) @@ -75,22 +75,22 @@ final class LazyReferenceTests: XCTestCase { XCTAssertEqual(loadedPost.title, post.title) } } - + func testEncodeNotLoaded() async throws { var comment = LazyChildComment4V2(id: "commentId", content: "content") let modelProvider = MockModelProvider(loadedState: .notLoaded(identifiers: [.init(name: "id", value: "postId")])).eraseToAnyModelProvider() - + comment._post = LazyReference(modelProvider: modelProvider) let json = try comment.toJSON() let expectedJSON = #"{"content":"content","createdAt":null,"id":"commentId","post":[{"name":"id","value":"postId"}],"updatedAt":null}"# XCTAssertEqual(json, expectedJSON) } - + func testDecodePrimaryKeysOnly() async throws { let postIdentifierName = "id" let postIdentifierValue = UUID().uuidString - + let commentWithLazyPostJSON = """ { "post": { @@ -102,21 +102,21 @@ final class LazyReferenceTests: XCTestCase { "createdAt": null } """ - + let model = try ModelRegistry.decode( modelName: LazyChildComment4V2.modelName, from: commentWithLazyPostJSON ) - + let decodedComment = try XCTUnwrap(model as? LazyChildComment4V2) - + switch decodedComment._post.loadedState { case .notLoaded(let unloadedIdentifiers): let identifiers = try XCTUnwrap(unloadedIdentifiers) let descriptions = identifiers.map { "\($0.name): \($0.value)" } - + XCTAssertEqual(descriptions, ["\(postIdentifierName): \(postIdentifierValue)"]) - + case .loaded: XCTFail("Should be not loaded") } diff --git a/AmplifyTests/CategoryTests/DataStore/Model/ListPaginationTests.swift b/AmplifyTests/CategoryTests/DataStore/Model/ListPaginationTests.swift index 83215fc64e..284228e8d8 100644 --- a/AmplifyTests/CategoryTests/DataStore/Model/ListPaginationTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/Model/ListPaginationTests.swift @@ -9,7 +9,7 @@ import XCTest @testable import Amplify extension ListTests { - + func testFetchSuccess() async throws { let mockListProvider = MockListProvider(elements: [BasicModel]()).eraseToAnyModelListProvider() let list = List(listProvider: mockListProvider) @@ -19,7 +19,7 @@ extension ListTests { } let fetchComplete = expectation(description: "fetch completed") Task { - + try await list.fetch() guard case .loaded = list.loadedState else { XCTFail("Should be loaded") @@ -28,7 +28,7 @@ extension ListTests { fetchComplete.fulfill() } await fulfillment(of: [fetchComplete], timeout: 1) - + let fetchComplete2 = expectation(description: "fetch completed") Task { try await list.fetch() @@ -60,7 +60,7 @@ extension ListTests { } fetchCompleted.fulfill() } - + await fulfillment(of: [fetchCompleted], timeout: 1.0) } @@ -100,7 +100,7 @@ extension ListTests { getNextPageSuccess.fulfill() } await fulfillment(of: [getNextPageSuccess], timeout: 1.0) - + guard case .loaded = list.loadedState else { XCTFail("Should be loaded") return @@ -128,7 +128,7 @@ extension ListTests { fetchCompleted.fulfill() } await fulfillment(of: [fetchCompleted], timeout: 1.0) - + let getNextPageSuccess = expectation(description: "getNextPage successful") Task { do { diff --git a/AmplifyTests/CategoryTests/DataStore/Model/ListTests.swift b/AmplifyTests/CategoryTests/DataStore/Model/ListTests.swift index 26cefa0422..495caf26eb 100644 --- a/AmplifyTests/CategoryTests/DataStore/Model/ListTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/Model/ListTests.swift @@ -43,13 +43,14 @@ class ListTests: XCTestCase { var errorOnNextPage: CoreError? 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) { + state: ModelListProviderState? = nil) + { self.elements = elements self.error = error self.errorOnLoad = errorOnLoad @@ -61,9 +62,9 @@ class ListTests: XCTestCase { public func getState() -> ModelListProviderState { state ?? .notLoaded(associatedIdentifiers: [""], associatedFields: [""]) } - + public func load(completion: (Result<[Element], CoreError>) -> Void) { - if let error = error { + if let error { completion(.failure(error)) } else if let error = errorOnLoad { completion(.failure(error)) @@ -71,9 +72,9 @@ class ListTests: XCTestCase { completion(.success(elements)) } } - + public func load() async throws -> [Element] { - if let error = error { + if let error { throw error } else if let error = errorOnLoad { throw error @@ -87,29 +88,29 @@ class ListTests: XCTestCase { } public func getNextPage(completion: (Result, CoreError>) -> Void) { - if let error = error { + if let error { completion(.failure(error)) } else if let error = errorOnNextPage { completion(.failure(error)) - } else if let nextPage = nextPage { + } else if let nextPage { completion(.success(nextPage)) } else { fatalError("Mock not implemented") } } - + public func getNextPage() async throws -> List { - if let error = error { + if let error { throw error } else if let error = errorOnNextPage { throw error - } else if let nextPage = nextPage { + } else if let nextPage { return nextPage } else { fatalError("Mock not implemented") } } - + func encode(to encoder: Encoder) throws { try elements.encode(to: encoder) } @@ -137,7 +138,7 @@ class ListTests: XCTestCase { fetchSuccess.fulfill() } await fulfillment(of: [fetchSuccess], timeout: 1.0) - + XCTAssertEqual(list.count, 2) XCTAssertEqual(list.startIndex, 0) XCTAssertEqual(list.endIndex, 2) @@ -145,7 +146,7 @@ class ListTests: XCTestCase { XCTAssertNotNil(list[0]) let iterateSuccess = expectation(description: "Iterate over the list successfullly") iterateSuccess.expectedFulfillmentCount = 2 - list.makeIterator().forEach { _ in + for _ in list.makeIterator() { iterateSuccess.fulfill() } await fulfillment(of: [iterateSuccess], timeout: 1) @@ -178,7 +179,7 @@ class ListTests: XCTestCase { XCTAssertNotNil(list[0]) let iterateSuccess = expectation(description: "Iterate over the list successfullly") iterateSuccess.expectedFulfillmentCount = 2 - list.makeIterator().forEach { _ in + for _ in list.makeIterator() { iterateSuccess.fulfill() } await fulfillment(of: [iterateSuccess], timeout: 1) @@ -238,7 +239,7 @@ class ListTests: XCTestCase { return try encoder.encode(json) } - private static func toJSON(list: List) throws -> String { + private static func toJSON(list: List) throws -> String { let encoder = JSONEncoder() encoder.dateEncodingStrategy = ModelDateFormatting.encodingStrategy let data = try encoder.encode(list) diff --git a/AmplifyTests/CategoryTests/DataStore/ModelIdentifierTests.swift b/AmplifyTests/CategoryTests/DataStore/ModelIdentifierTests.swift index 8d8f607f21..56fddc6429 100644 --- a/AmplifyTests/CategoryTests/DataStore/ModelIdentifierTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/ModelIdentifierTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify import AmplifyTestCommon +import XCTest class ModelIdentifierTests: XCTestCase { override func setUp() { diff --git a/AmplifyTests/CategoryTests/DataStore/ModelPrimaryKeyTests.swift b/AmplifyTests/CategoryTests/DataStore/ModelPrimaryKeyTests.swift index 7554746cea..1e871a2b1e 100644 --- a/AmplifyTests/CategoryTests/DataStore/ModelPrimaryKeyTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/ModelPrimaryKeyTests.swift @@ -98,7 +98,7 @@ class ModelPrimaryKeyTests: XCTestCase { let expectedFieldsNames = ["id", "dob", "date", "time", "phoneNumber", "priority", "height"] XCTAssertEqual(primaryKey.isCompositeKey, true) XCTAssertEqual(primaryKey.fields.count, 7) - XCTAssertEqual(primaryKey.fields.map { $0.name }, expectedFieldsNames) + XCTAssertEqual(primaryKey.fields.map(\.name), expectedFieldsNames) } /// Given: a schema for model with a composite primary key field @@ -110,7 +110,7 @@ class ModelPrimaryKeyTests: XCTestCase { let expectedFieldsNames = ["id", "dob"] XCTAssertEqual(primaryKey.isCompositeKey, true) XCTAssertEqual(primaryKey.fields.count, 2) - XCTAssertEqual(primaryKey.fields.map { $0.name }, expectedFieldsNames) + XCTAssertEqual(primaryKey.fields.map(\.name), expectedFieldsNames) } /// Given: a schema for model with a legacy composite primary key field @@ -121,7 +121,7 @@ class ModelPrimaryKeyTests: XCTestCase { let expectedFieldsNames = ["orderId", "id"] XCTAssertEqual(primaryKey.isCompositeKey, true) XCTAssertEqual(primaryKey.fields.count, 2) - XCTAssertEqual(primaryKey.fields.map { $0.name }, expectedFieldsNames) + XCTAssertEqual(primaryKey.fields.map(\.name), expectedFieldsNames) } /// Given: a schema for model with an untyped model diff --git a/AmplifyTests/CategoryTests/DataStore/ModelRegistryTests.swift b/AmplifyTests/CategoryTests/DataStore/ModelRegistryTests.swift index 86a848511a..e9db674dd4 100644 --- a/AmplifyTests/CategoryTests/DataStore/ModelRegistryTests.swift +++ b/AmplifyTests/CategoryTests/DataStore/ModelRegistryTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest @testable import AmplifyTestCommon class ModelRegistryTests: XCTestCase { diff --git a/AmplifyTests/CategoryTests/Geo/GeoCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Geo/GeoCategoryConfigurationTests.swift index 75767a9689..f13b3b181e 100644 --- a/AmplifyTests/CategoryTests/Geo/GeoCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Geo/GeoCategoryConfigurationTests.swift @@ -81,7 +81,8 @@ 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 + "Getting a plugin after reset() should throw") + { error in guard case Geo.Error.invalidConfiguration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -240,7 +241,8 @@ 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 + "configure() an already configured plugin should throw") + { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -317,7 +319,8 @@ class GeoCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") { error in + "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 0a5b3a01d1..12e080eb1e 100644 --- a/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift +++ b/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift @@ -121,7 +121,8 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { func getURL(key: String, options: StorageGetURLRequest.Options? = nil, - resultListener: StorageGetURLOperation.ResultListener? = nil) -> StorageGetURLOperation { + resultListener: StorageGetURLOperation.ResultListener? = nil) -> StorageGetURLOperation + { let options = options ?? StorageGetURLRequest.Options() let request = StorageGetURLRequest(key: key, options: options) @@ -196,7 +197,8 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { func remove(key: String, options: StorageRemoveRequest.Options? = nil, - resultListener: StorageRemoveOperation.ResultListener? = nil) -> StorageRemoveOperation { + resultListener: StorageRemoveOperation.ResultListener? = nil) -> StorageRemoveOperation + { let options = options ?? StorageRemoveRequest.Options() let request = StorageRemoveRequest(key: key, options: options) @@ -207,7 +209,8 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { } func list(options: StorageListRequest.Options?, - resultListener: StorageListOperation.ResultListener?) -> StorageListOperation { + resultListener: StorageListOperation.ResultListener?) -> StorageListOperation + { let options = options ?? StorageListRequest.Options() let request = StorageListRequest(options: options) @@ -229,7 +232,8 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { @discardableResult func getURL(key: String, - options: StorageGetURLOperation.Request.Options?) async throws -> URL { + options: StorageGetURLOperation.Request.Options?) async throws -> URL + { let options = options ?? StorageGetURLRequest.Options() let request = StorageGetURLRequest(key: key, options: options) let operation = MockStorageGetURLOperation(request: request) @@ -239,7 +243,8 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { @discardableResult public func downloadData(key: String, - options: StorageDownloadDataOperation.Request.Options? = nil) -> StorageDownloadDataTask { + options: StorageDownloadDataOperation.Request.Options? = nil) -> StorageDownloadDataTask + { let options = options ?? StorageDownloadDataRequest.Options() let request = StorageDownloadDataRequest(key: key, options: options) let operation = MockDispatchingStorageDownloadDataOperation(request: request) @@ -250,7 +255,8 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { @discardableResult public func downloadFile(key: String, local: URL, - options: StorageDownloadFileOperation.Request.Options?) -> StorageDownloadFileTask { + options: StorageDownloadFileOperation.Request.Options?) -> StorageDownloadFileTask + { let options = options ?? StorageDownloadFileRequest.Options() let request = StorageDownloadFileRequest(key: key, local: local, options: options) let operation = MockDispatchingStorageDownloadFileOperation(request: request) @@ -261,7 +267,8 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { @discardableResult public func uploadData(key: String, data: Data, - options: StorageUploadDataOperation.Request.Options?) -> StorageUploadDataTask { + options: StorageUploadDataOperation.Request.Options?) -> StorageUploadDataTask + { let options = options ?? StorageUploadDataRequest.Options() let request = StorageUploadDataRequest(key: key, data: data, options: options) let operation = MockDispatchingStorageUploadDataOperation(request: request) @@ -272,7 +279,8 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { @discardableResult public func uploadFile(key: String, local: URL, - options: StorageUploadFileOperation.Request.Options?) -> StorageUploadFileTask { + options: StorageUploadFileOperation.Request.Options?) -> StorageUploadFileTask + { let options = options ?? StorageUploadFileRequest.Options() let request = StorageUploadFileRequest(key: key, local: local, options: options) let operation = MockDispatchingStorageUploadFileOperation(request: request) @@ -282,7 +290,8 @@ class MockDispatchingStoragePlugin: StorageCategoryPlugin { @discardableResult public func remove(key: String, - options: StorageRemoveRequest.Options? = nil) async throws -> 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) diff --git a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginConcurrencyTests.swift b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginConcurrencyTests.swift index 0f8284a3d5..1c75747e5a 100644 --- a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginConcurrencyTests.swift +++ b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginConcurrencyTests.swift @@ -12,7 +12,8 @@ import XCTest class DefaultHubPluginConcurrencyTests: XCTestCase { var plugin: HubCategoryPlugin { guard let plugin = try? Amplify.Hub.getPlugin(for: "awsHubPlugin"), - plugin.key == "awsHubPlugin" else { + plugin.key == "awsHubPlugin" + else { fatalError("Could not access AWSHubPlugin") } return plugin @@ -68,7 +69,7 @@ class DefaultHubPluginConcurrencyTests: XCTestCase { messagesReceived.append(messageReceived) } } - + let capturedChannels = channels DispatchQueue.concurrentPerform(iterations: channels.count) { iteration in diff --git a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginCustomChannelTests.swift b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginCustomChannelTests.swift index 0e7e0892f5..d02e5207d4 100644 --- a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginCustomChannelTests.swift +++ b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginCustomChannelTests.swift @@ -14,7 +14,8 @@ class DefaultHubPluginCustomChannelTests: XCTestCase { var plugin: HubCategoryPlugin { guard let plugin = try? Amplify.Hub.getPlugin(for: "awsHubPlugin"), - plugin.key == "awsHubPlugin" else { + plugin.key == "awsHubPlugin" + else { fatalError("Could not access AWSHubPlugin") } return plugin diff --git a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginTests.swift b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginTests.swift index bf8fc5394a..2f4b42a422 100644 --- a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginTests.swift +++ b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginTests.swift @@ -14,7 +14,8 @@ class DefaultHubPluginTests: XCTestCase { var plugin: HubCategoryPlugin { guard let plugin = try? Amplify.Hub.getPlugin(for: "awsHubPlugin"), - plugin.key == "awsHubPlugin" else { + plugin.key == "awsHubPlugin" + else { fatalError("Could not access AWSHubPlugin") } return plugin @@ -123,13 +124,14 @@ class DefaultHubPluginTests: XCTestCase { currentExpectation = expectation(description: "Message was received as expected") guard try await HubListenerTestUtilities.waitForListener(with: unsubscribeToken, plugin: plugin, - timeout: 0.5) else { + timeout: 0.5) + else { XCTFail("Token with \(unsubscribeToken.id) was not registered") return } plugin.dispatch(to: .storage, payload: HubPayload(eventName: "TEST_EVENT")) - await fulfillment(of: [try XCTUnwrap(currentExpectation)], timeout: 0.5) + try await fulfillment(of: [XCTUnwrap(currentExpectation)], timeout: 0.5) plugin.removeListener(unsubscribeToken) try? await Task.sleep(seconds: 0.01) @@ -138,8 +140,8 @@ class DefaultHubPluginTests: XCTestCase { currentExpectation = expectation(description: "Message was received after removing listener") currentExpectation?.isInverted = true - await isStillRegistered.set( - try HubListenerTestUtilities.waitForListener(with: unsubscribeToken, + try await isStillRegistered.set( + HubListenerTestUtilities.waitForListener(with: unsubscribeToken, plugin: plugin, timeout: 0.5) ) @@ -147,7 +149,7 @@ class DefaultHubPluginTests: XCTestCase { XCTAssertFalse(isStillRegistered.get(), "Should not be registered after removeListener") plugin.dispatch(to: .storage, payload: HubPayload(eventName: "TEST_EVENT")) - await fulfillment(of: [try XCTUnwrap(currentExpectation)], timeout: 0.5) + try await fulfillment(of: [XCTUnwrap(currentExpectation)], timeout: 0.5) } /// Given: The default Hub plugin diff --git a/AmplifyTests/CategoryTests/Hub/HubCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Hub/HubCategoryConfigurationTests.swift index 8f894b74e8..758f4d29b2 100644 --- a/AmplifyTests/CategoryTests/Hub/HubCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Hub/HubCategoryConfigurationTests.swift @@ -99,7 +99,8 @@ 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 + "Getting a plugin after reset() should throw") + { error in guard case HubError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -262,7 +263,8 @@ 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 + "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 4f3aedc3fb..9d362627f8 100644 --- a/AmplifyTests/CategoryTests/Hub/HubCombineTests.swift +++ b/AmplifyTests/CategoryTests/Hub/HubCombineTests.swift @@ -6,8 +6,8 @@ // #if canImport(Combine) -import XCTest import Combine +import XCTest @testable import Amplify @testable import AmplifyTestCommon diff --git a/AmplifyTests/CategoryTests/Hub/HubListenerTests.swift b/AmplifyTests/CategoryTests/Hub/HubListenerTests.swift index ba6e2f415b..b77ced94fe 100644 --- a/AmplifyTests/CategoryTests/Hub/HubListenerTests.swift +++ b/AmplifyTests/CategoryTests/Hub/HubListenerTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest @testable import AmplifyTestCommon diff --git a/AmplifyTests/CategoryTests/Logging/DefaultLoggingPluginAmplifyVersionableTests.swift b/AmplifyTests/CategoryTests/Logging/DefaultLoggingPluginAmplifyVersionableTests.swift index c2716d0968..67ced0b842 100644 --- a/AmplifyTests/CategoryTests/Logging/DefaultLoggingPluginAmplifyVersionableTests.swift +++ b/AmplifyTests/CategoryTests/Logging/DefaultLoggingPluginAmplifyVersionableTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest // swiftlint:disable:next type_name class DefaultLoggingPluginAmplifyVersionableTests: XCTestCase { diff --git a/AmplifyTests/CategoryTests/Logging/LoggingCategoryClientAPITests.swift b/AmplifyTests/CategoryTests/Logging/LoggingCategoryClientAPITests.swift index b155cf8a2f..5a774fd686 100644 --- a/AmplifyTests/CategoryTests/Logging/LoggingCategoryClientAPITests.swift +++ b/AmplifyTests/CategoryTests/Logging/LoggingCategoryClientAPITests.swift @@ -164,19 +164,19 @@ class NonEvaluatingLoggingPlugin: LoggingCategoryPlugin, Logger { var `default`: Logger { self } - + func enable() { - + } - + func disable() { - + } - + func logger(forNamespace namespace: String) -> Logger { self } - + func logger(forCategory category: String, forNamespace namespace: String) -> Logger { self } diff --git a/AmplifyTests/CategoryTests/Logging/LoggingCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Logging/LoggingCategoryConfigurationTests.swift index 15432c3aab..1395ac6120 100644 --- a/AmplifyTests/CategoryTests/Logging/LoggingCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Logging/LoggingCategoryConfigurationTests.swift @@ -83,7 +83,8 @@ 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 + "Getting a plugin after reset() should throw") + { error in guard case LoggingError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -250,7 +251,8 @@ 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 + "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/NotificationsCategoryTests.swift b/AmplifyTests/CategoryTests/Notifications/NotificationsCategoryTests.swift index 0393afb838..de6c940c21 100644 --- a/AmplifyTests/CategoryTests/Notifications/NotificationsCategoryTests.swift +++ b/AmplifyTests/CategoryTests/Notifications/NotificationsCategoryTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import XCTest @testable import Amplify @testable import AmplifyTestCommon -import XCTest final class NotificationsCategoryTests: XCTestCase { private var category: NotificationsCategory! @@ -32,7 +32,7 @@ final class NotificationsCategoryTests: XCTestCase { plugins: [notificationsPlugin.key: true] ) try Amplify.add(plugin: notificationsPlugin) - try Amplify.configure(AmplifyConfiguration(notifications:notificationsConfig)) + try Amplify.configure(AmplifyConfiguration(notifications: notificationsConfig)) let configuredCategories = category.subcategories XCTAssertEqual(configuredCategories.count, 1) diff --git a/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryClientAPITests.swift b/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryClientAPITests.swift index 6f18b35b6a..4417722a1f 100644 --- a/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryClientAPITests.swift +++ b/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryClientAPITests.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -@testable import Amplify -@testable import AmplifyTestCommon import UserNotifications import XCTest +@testable import Amplify +@testable import AmplifyTestCommon class PushNotificationsCategoryClientAPITests: XCTestCase { private var category: PushNotificationsCategory! @@ -18,11 +18,11 @@ class PushNotificationsCategoryClientAPITests: XCTestCase { await Amplify.reset() category = Amplify.Notifications.Push plugin = MockPushNotificationsCategoryPlugin() - + let categoryConfiguration = NotificationsCategoryConfiguration( plugins: ["MockPushNotificationsCategoryPlugin": true] ) - + let amplifyConfiguration = AmplifyConfiguration(notifications: categoryConfiguration) try Amplify.add(plugin: plugin) try Amplify.configure(amplifyConfiguration) diff --git a/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryConfigurationTests.swift index 5e0214ec44..a19b4baf08 100644 --- a/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Notifications/Push/PushNotificationsCategoryConfigurationTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import XCTest @_spi(InternalAmplifyConfiguration) @testable import Amplify @testable import AmplifyTestCommon -import XCTest class PushNotificationsCategoryConfigurationTests: XCTestCase { // MARK: - Setup methods @@ -35,7 +35,7 @@ class PushNotificationsCategoryConfigurationTests: XCTestCase { private func createAmplifyConfig(hasSecondPlugin: Bool = false) -> AmplifyConfiguration { let categoryConfiguration = createCategoryConfig(hasSecondPlugin: hasSecondPlugin) - + return AmplifyConfiguration(notifications: categoryConfiguration) } @@ -52,7 +52,8 @@ class PushNotificationsCategoryConfigurationTests: XCTestCase { try Amplify.configure(createAmplifyConfig()) XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") { error in + "configure() an already configured plugin should throw") + { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -67,7 +68,8 @@ class PushNotificationsCategoryConfigurationTests: XCTestCase { try Amplify.Notifications.Push.configure(using: categoryConfig) XCTAssertThrowsError(try Amplify.Notifications.Push.configure(using: categoryConfig), - "configure() an already configured plugin should throw") { error in + "configure() an already configured plugin should throw") + { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -205,7 +207,8 @@ class PushNotificationsCategoryConfigurationTests: XCTestCase { await Amplify.reset() XCTAssertThrowsError(try Amplify.Notifications.Push.getPlugin(for: "MockPushNotificationsCategoryPlugin"), - "Getting a plugin after reset() should throw") { error in + "Getting a plugin after reset() should throw") + { error in guard case PushNotificationsError.configuration = error else { XCTFail("Expected PushNotificationsError.configuration error") return @@ -224,7 +227,7 @@ class PushNotificationsCategoryConfigurationTests: XCTestCase { XCTAssertNotNil(try Amplify.Notifications.Push.getPlugin(for: "MockPushNotificationsCategoryPlugin")) XCTAssertNotNil(try Amplify.Notifications.Push.getPlugin(for: "MockPushNotificationsCategoryPlugin")) } - + func testUsingPlugin_withMultiplePlugins_shouldSucceed() async throws { let plugin1 = MockPushNotificationsCategoryPlugin() let methodShouldNotBeInvokedOnDefaultPlugin = @@ -236,7 +239,7 @@ class PushNotificationsCategoryConfigurationTests: XCTestCase { } } try Amplify.add(plugin: plugin1) - + let plugin2 = MockSecondPushNotificationsCategoryPlugin() let methodShouldBeInvokedOnSecondPlugin = expectation(description: "test method should be invoked on second plugin") diff --git a/AmplifyTests/CategoryTests/Predictions/ModelsTest/LanguageTypeTest.swift b/AmplifyTests/CategoryTests/Predictions/ModelsTest/LanguageTypeTest.swift index 9c2d8c7aba..935af8d7b2 100644 --- a/AmplifyTests/CategoryTests/Predictions/ModelsTest/LanguageTypeTest.swift +++ b/AmplifyTests/CategoryTests/Predictions/ModelsTest/LanguageTypeTest.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest class LanguageTypeTest: XCTestCase { diff --git a/AmplifyTests/CategoryTests/Predictions/PredictionsCategoryConfigurationTests.swift b/AmplifyTests/CategoryTests/Predictions/PredictionsCategoryConfigurationTests.swift index 8aca2e84ea..ede6a88c1b 100644 --- a/AmplifyTests/CategoryTests/Predictions/PredictionsCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Predictions/PredictionsCategoryConfigurationTests.swift @@ -221,7 +221,8 @@ 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 + "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 49d2a3cc47..0cf8e8048a 100644 --- a/AmplifyTests/CategoryTests/Storage/StorageCategoryConfigurationTests.swift +++ b/AmplifyTests/CategoryTests/Storage/StorageCategoryConfigurationTests.swift @@ -82,7 +82,8 @@ 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 + "Getting a plugin after reset() should throw") + { error in guard case StorageError.configuration = error else { XCTFail("Expected PluginError.noSuchPlugin") return @@ -257,7 +258,8 @@ 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 + "configure() an already configured plugin should throw") + { error in guard case ConfigurationError.amplifyAlreadyConfigured = error else { XCTFail("Expected ConfigurationError.amplifyAlreadyConfigured") return @@ -334,7 +336,8 @@ class StorageCategoryConfigurationTests: XCTestCase { try Amplify.configure(amplifyConfig) XCTAssertThrowsError(try Amplify.add(plugin: plugin), - "configure() an already configured plugin should throw") { error in + "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/AmplifyAsyncSequenceTests.swift b/AmplifyTests/CoreTests/AmplifyAsyncSequenceTests.swift index 044282d285..cb4645a11d 100644 --- a/AmplifyTests/CoreTests/AmplifyAsyncSequenceTests.swift +++ b/AmplifyTests/CoreTests/AmplifyAsyncSequenceTests.swift @@ -114,14 +114,14 @@ final class AmplifyAsyncSequenceTests: XCTestCase { } XCTAssertNotNil(thrown) - let expected = Array(input[0..<2]) + let expected = Array(input[0 ..< 2]) XCTAssertEqual(expected, output) } func testChannelCancelled() async throws { // parent task is canceled while reducing values from sequence // before a value is sent which should result in a sum of zero - let input = 2006 + let input = 2_006 let reduced = expectation(description: "reduced") let done = expectation(description: "done") let channel = AmplifyAsyncSequence() @@ -151,7 +151,7 @@ final class AmplifyAsyncSequenceTests: XCTestCase { func testThrowingChannelCancelled() async throws { // parent task is canceled while reducing values from sequence // before a value is sent which should result in a sum of zero - let input = 2006 + let input = 2_006 let reduced = expectation(description: "reduced") let done = expectation(description: "done") let channel = AmplifyAsyncThrowingSequence() @@ -225,7 +225,7 @@ final class AmplifyAsyncSequenceTests: XCTestCase { let token = operation.subscribe { (value: LongOperation.InProcess) in count += 1 channel.send(value) - if value.completedUnitCount >= steps/2 { + if value.completedUnitCount >= steps / 2 { channel.cancel() sent.fulfill() } @@ -297,7 +297,7 @@ final class AmplifyAsyncSequenceTests: XCTestCase { let token = operation.subscribe { (value: LongOperation.InProcess) in count += 1 channel.send(value) - if value.completedUnitCount >= steps/2 { + if value.completedUnitCount >= steps / 2 { channel.cancel() sent.fulfill() } @@ -338,7 +338,7 @@ final class AmplifyAsyncSequenceTests: XCTestCase { while index < elements.count { try await Task.sleep(seconds: sleepSeconds) let element = elements[index] - if let processor = processor { + if let processor { do { let processed = try processor(element) channel.send(processed) diff --git a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationChainedTests.swift b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationChainedTests.swift index 30ea3d6b7c..4d5dff4464 100644 --- a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationChainedTests.swift +++ b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationChainedTests.swift @@ -6,8 +6,8 @@ // #if canImport(Combine) -import XCTest import Combine +import XCTest @testable import Amplify @testable import AmplifyTestCommon @@ -90,7 +90,7 @@ class AmplifyInProcessReportingOperationChainedTests: XCTestCase { let sink = Publishers.Zip( mockOp1.internalResultPublisher, mockOp2.internalResultPublisher - ).flatMap { (_, _) -> AnyPublisher in + ).flatMap { _, _ -> AnyPublisher in let mockOp = MockPublisherInProcessOperation(responder: failureResponder) mockOp.main() return mockOp.internalResultPublisher diff --git a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift index 6452d90e08..a07b70c55d 100644 --- a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift +++ b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift @@ -6,8 +6,8 @@ // #if canImport(Combine) -import XCTest import Combine +import XCTest @testable import Amplify @testable import AmplifyTestCommon diff --git a/AmplifyTests/CoreTests/AmplifyOperationCombineTests.swift b/AmplifyTests/CoreTests/AmplifyOperationCombineTests.swift index ec85f46e58..5ca4f421d8 100644 --- a/AmplifyTests/CoreTests/AmplifyOperationCombineTests.swift +++ b/AmplifyTests/CoreTests/AmplifyOperationCombineTests.swift @@ -6,8 +6,8 @@ // #if canImport(Combine) -import XCTest import Combine +import XCTest @testable import Amplify @testable import AmplifyTestCommon @@ -181,7 +181,7 @@ class AmplifyOperationCombineTests: XCTestCase { let sink = Publishers.Zip( mockOp1.internalResultPublisher, mockOp2.internalResultPublisher - ).flatMap { (_, _) -> AnyPublisher in + ).flatMap { _, _ -> AnyPublisher in let mockOp = MockPublisherOperation(responder: failureResponder) mockOp.main() return mockOp.internalResultPublisher @@ -280,7 +280,7 @@ class MockPublisherOperation: AmplifyOperation() var output = [Int]() let finished = expectation(description: "completion finished") let received = expectation(description: "values received") - + let sink = Amplify.Publisher.create(sequence) .sink { completion in switch completion { @@ -152,11 +152,11 @@ class AmplifyPublisherTests: XCTestCase { } func testCreateFromAmplifyAsyncThrowingSequenceSuccess() async throws { - let input = Array(1...100) + let input = Array(1 ... 100) let sequence = AmplifyAsyncThrowingSequence() var output = [Int]() let finished = expectation(description: "completion finished") - + let sink = Amplify.Publisher.create(sequence) .sink { completion in switch completion { @@ -181,7 +181,7 @@ class AmplifyPublisherTests: XCTestCase { let sequence = Doubles() var output = [Int]() let finished = expectation(description: "completion finished") - + let sink = Amplify.Publisher.create(sequence) .sink { completion in switch completion { @@ -200,13 +200,13 @@ class AmplifyPublisherTests: XCTestCase { } sink.cancel() } - + func testCreateFromBasicAsyncSequenceFail() async throws { let expected = [1, 2, 4] let sequence = Doubles(fails: true) var output = [Int]() let failed = expectation(description: "completion failed") - + let sink = Amplify.Publisher.create(sequence) .sink { completion in switch completion { @@ -228,20 +228,20 @@ class AmplifyPublisherTests: XCTestCase { } func testCreateFromAmplifyAsyncSequenceCancelSink() async throws { - let input = Array(1...100) + let input = Array(1 ... 100) let expected = [Int]() let sequence = AmplifyAsyncSequence() var output = [Int]() let completed = expectation(description: "should not have completed") completed.isInverted = true - + let sink = Amplify.Publisher.create(sequence) .sink { completion in completed.fulfill() } receiveValue: { value in output.append(value) } - + sink.cancel() send(input: input, sequence: sequence) @@ -249,7 +249,7 @@ class AmplifyPublisherTests: XCTestCase { await fulfillment(of: [completed], timeout: 0.1) XCTAssertEqual(expected, output) } - + func testCreateFromAmplifyAsyncSequenceCancelSequence() async throws { let expected = [Int]() let sequence = AmplifyAsyncSequence() @@ -276,7 +276,8 @@ class AmplifyPublisherTests: XCTestCase { private func send(input: [Element], sequence: AmplifyAsyncSequence, - finish: Bool = true) { + finish: Bool = true) + { for value in input { sequence.send(value) } @@ -287,7 +288,8 @@ class AmplifyPublisherTests: XCTestCase { private func send(input: [Element], throwingSequence: AmplifyAsyncThrowingSequence, - finish: Bool = true) { + finish: Bool = true) + { for value in input { throwingSequence.send(value) } @@ -298,24 +300,24 @@ class AmplifyPublisherTests: XCTestCase { private struct Doubles: AsyncSequence { let fails: Bool - + init(fails: Bool = false) { self.fails = fails } typealias Element = Int - + func makeAsyncIterator() -> AsyncIterator { AsyncIterator(fails: fails) } - + struct AsyncIterator: AsyncIteratorProtocol { let fails: Bool - + init(fails: Bool = false) { self.fails = fails } - + var current = 1 mutating func next() async throws -> Element? { diff --git a/AmplifyTests/CoreTests/AmplifyTaskQueueTests.swift b/AmplifyTests/CoreTests/AmplifyTaskQueueTests.swift index 48c19c9182..5d9a74d94b 100644 --- a/AmplifyTests/CoreTests/AmplifyTaskQueueTests.swift +++ b/AmplifyTests/CoreTests/AmplifyTaskQueueTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest // As expected, running this work as straight up Task invocations: @@ -68,18 +68,18 @@ final class AmplifyTaskQueueTests: XCTestCase { func testAsync() async throws { let taskCount = 1_000 - let expectations: [XCTestExpectation] = (0..() - - for i in 0.. String { - let range = [UInt32](0x1F601...0x1F64F) - let ascii = range[Int(drand48() * (Double(range.count)))] + let range = [UInt32](0x1f601 ... 0x1f64f) + let ascii = range[Int(drand48() * Double(range.count))] let emoji = UnicodeScalar(ascii)?.description return emoji! } diff --git a/AmplifyTests/CoreTests/TreeTests.swift b/AmplifyTests/CoreTests/TreeTests.swift index c5f14142dc..506f4c2220 100644 --- a/AmplifyTests/CoreTests/TreeTests.swift +++ b/AmplifyTests/CoreTests/TreeTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest class TreeTests: XCTestCase { diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLI.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLI.swift index 58c7bdc4ce..b858823db7 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLI.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLI.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation -import ArgumentParser import AmplifyXcodeCore +import ArgumentParser +import Foundation /// This module defines a CLI (Command Line Interface) to commands defined in `Core/Commands`. /// Each "CLI command" is the actual executor of an `AmplifyCommand`, thus it's responsible diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommand.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommand.swift index 37dbc6e2f1..055110217d 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommand.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommand.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import ArgumentParser +import Foundation protocol CLICommandInitializable { init() @@ -36,6 +36,6 @@ extension CLICommand { // MARK: - ParsableCommand + CLICommandEncodable extension CLICommand where Self: ParsableCommand { - static var commandName: String { Self.configuration.commandName! } - static var abstract: String { Self.configuration.abstract } + static var commandName: String { configuration.commandName! } + static var abstract: String { configuration.abstract } } diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandGenerateJSONSchema.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandGenerateJSONSchema.swift index 461bc5a978..fbea51f09f 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandGenerateJSONSchema.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandGenerateJSONSchema.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import AmplifyXcodeCore import ArgumentParser +import Foundation /// Encodable representation of the `amplify-xcode` CLI. /// In order to get the necessary information to produce a representation of each commands, diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandImportConfig.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandImportConfig.swift index 9b6f821c89..3e03c2f21d 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandImportConfig.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandImportConfig.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation -import ArgumentParser import AmplifyXcodeCore +import ArgumentParser +import Foundation /// CLI command invoking `CommandImportConfig`. struct CLICommandImportConfig: ParsableCommand, CommandExecutable, CLICommandReportable, CLICommand { diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandImportModels.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandImportModels.swift index 86761b06a0..9bea0572e9 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandImportModels.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandImportModels.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation -import ArgumentParser import AmplifyXcodeCore +import ArgumentParser +import Foundation /// CLI command invoking `CommandImportModels`. struct CLICommandImportModels: ParsableCommand, CommandExecutable, CLICommandReportable, CLICommand { diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandReportable.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandReportable.swift index 2387723d43..46577a089a 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandReportable.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/CLICommandReportable.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import AmplifyXcodeCore +import Foundation protocol CLICommandReportable { func report(result: AmplifyCommandResult) diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/Support/ArgumentParser+CLICommand.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/Support/ArgumentParser+CLICommand.swift index 073e47ea81..85c58b5ee0 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/Support/ArgumentParser+CLICommand.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcode/Support/ArgumentParser+CLICommand.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import ArgumentParser +import Foundation /// The following extensions on ArgumentParser commands parameters property wrappers /// help us providing a hook to generate a JSON representation of a CLI command. diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/AmplifyCommandError.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/AmplifyCommandError.swift index 498dc4543e..be6f049e62 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/AmplifyCommandError.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/AmplifyCommandError.swift @@ -26,7 +26,7 @@ public struct AmplifyCommandError: Error { self.errorDescription = errorDescription self.recoverySuggestion = recoverySuggestion - if let error = error { + if let error { self.underlyingErrors = [error] } } @@ -61,7 +61,7 @@ public extension AmplifyCommandError { components.append("-- Recovery suggestion: \(recoveryMsg)") } - guard let underlyingErrors = self.underlyingErrors else { + guard let underlyingErrors else { return components.joined(separator: "\n") } diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandExecutable.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandExecutable.swift index 77b4821eb1..f6c692c43f 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandExecutable.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandExecutable.swift @@ -18,7 +18,8 @@ public protocol CommandExecutable where Self: CommandEnvironmentProvider { public extension CommandExecutable { private func exec(_ task: AmplifyCommandTaskExecutor, args: TaskArgs, - prevResults: inout [AmplifyCommandTaskResult]) -> Bool { + prevResults: inout [AmplifyCommandTaskResult]) -> Bool + { let output = task(environment, args) switch output { case .failure: @@ -31,7 +32,7 @@ public extension CommandExecutable { } /// Given a command, executes its underlying tasks and aggregates the final result - func exec(command: Command) -> AmplifyCommandResult { + func exec(command: some AmplifyCommand) -> AmplifyCommandResult { var results: [AmplifyCommandTaskResult] = [] for task in command.tasks { diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportConfig.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportConfig.swift index 48b9e5d98f..2818c529c5 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportConfig.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportConfig.swift @@ -10,7 +10,8 @@ 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, @@ -22,7 +23,8 @@ enum ImportConfigTasks { 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( @@ -36,7 +38,8 @@ 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) } diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportModels.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportModels.swift index f1a15061ee..692c26abdd 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportModels.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Commands/CommandImportModels.swift @@ -10,13 +10,13 @@ import PathKit enum CommandImportModelsTasks { static func projectHasGeneratedModels(environment: AmplifyCommandEnvironment, - args: CommandImportModels.TaskArgs) -> AmplifyCommandTaskResult { + args: CommandImportModels.TaskArgs) -> AmplifyCommandTaskResult + { let modelsPath = environment.path(for: args.generatedModelsPath) guard environment.directoryExists(atPath: modelsPath) else { do { _ = try environment.createDirectory(atPath: args.generatedModelsPath) - } - catch { + } catch { return .failure( AmplifyCommandError( .folderNotFound, @@ -31,7 +31,8 @@ enum CommandImportModelsTasks { } static func addGeneratedModelsToProject(environment: AmplifyCommandEnvironment, - args: CommandImportModels.TaskArgs) -> AmplifyCommandTaskResult { + args: CommandImportModels.TaskArgs) -> AmplifyCommandTaskResult + { let models = environment.glob(pattern: "\(args.generatedModelsPath)/*.swift").map { environment.createXcodeFile(withPath: $0, ofType: .source) } diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/CommandEnvironment.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/CommandEnvironment.swift index f27ef1c488..30aa5dd06a 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/CommandEnvironment.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Environment/CommandEnvironment.swift @@ -21,21 +21,21 @@ public struct CommandEnvironment: AmplifyCommandEnvironment { } // MARK: - AmplifyCommandEnvironmentFileManager -extension CommandEnvironment { - public func path(for subpath: String) -> String { +public extension CommandEnvironment { + func path(for subpath: String) -> String { return URL(fileURLWithPath: subpath, relativeTo: basePathURL).path } - public func path(for components: [String]) -> String { + func path(for components: [String]) -> String { return path(for: components.joined(separator: "/")) } - public func glob(pattern: String) -> [String] { + func glob(pattern: String) -> [String] { let fullPath = path(for: pattern) return fileManager.glob(pattern: fullPath).map { $0 } } - @discardableResult public func createDirectory(atPath path: String) throws -> String { + @discardableResult func createDirectory(atPath path: String) throws -> String { let url = URL(fileURLWithPath: path, relativeTo: basePathURL) do { try fileManager.createDirectory(at: url, withIntermediateDirectories: true) @@ -45,7 +45,7 @@ extension CommandEnvironment { } } - @discardableResult public func createFile(atPath filePath: String, content: String) throws -> String { + @discardableResult func createFile(atPath filePath: String, content: String) throws -> String { let fullPath = path(for: filePath) if fileManager.createFile(atPath: fullPath, contents: content.data(using: .utf8)) { return fullPath @@ -53,7 +53,7 @@ extension CommandEnvironment { throw AmplifyCommandError(.unknown, error: nil) } - public func contentsOfDirectory(atPath directoryPath: String) throws -> [String] { + func contentsOfDirectory(atPath directoryPath: String) throws -> [String] { let fullPath = path(for: directoryPath) guard fileManager.directoryExists(atPath: fullPath) else { throw AmplifyCommandError( @@ -70,17 +70,17 @@ extension CommandEnvironment { } } - public func directoryExists(atPath dirPath: String) -> Bool { + func directoryExists(atPath dirPath: String) -> Bool { fileManager.directoryExists(atPath: path(for: dirPath)) } - public func fileExists(atPath filePath: String) -> Bool { + func fileExists(atPath filePath: String) -> Bool { fileManager.fileExists(atPath: path(for: filePath)) } } // MARK: - AmplifyCommandEnvironmentXcode -extension CommandEnvironment { +public extension CommandEnvironment { private func loadFirstXcodeProject(fromDirectory path: String) throws -> XcodeProject { let xcodeProjFiles = try contentsOfDirectory(atPath: path).filter { $0.hasSuffix("xcodeproj") @@ -98,15 +98,16 @@ extension CommandEnvironment { return try XcodeProject(at: path, projPath: self.path(for: projectName)) } - public func createXcodeFile(withPath path: String, ofType type: XcodeProjectFileType) -> XcodeProjectFile { + func createXcodeFile(withPath path: String, ofType type: XcodeProjectFileType) -> XcodeProjectFile { return XcodeProjectFile(path, type: type) } - public func addFilesToXcodeProject( + func addFilesToXcodeProject( 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) diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+AmplifyFileManager.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+AmplifyFileManager.swift index b1255dc31c..10fd6ca33f 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+AmplifyFileManager.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+AmplifyFileManager.swift @@ -18,6 +18,6 @@ extension FileManager: AmplifyFileManager { } public func glob(pattern: String) -> [String] { - Path.glob(pattern).map { $0.string } + Path.glob(pattern).map(\.string) } } diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+Utils.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+Utils.swift index 186479c316..6d2090a29b 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+Utils.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/FileManager+Utils.swift @@ -7,14 +7,14 @@ import Foundation -extension FileManager { - public func directoryExists(atPath path: String) -> Bool { +public extension FileManager { + func directoryExists(atPath path: String) -> Bool { var isDirectory = ObjCBool(false) let exists = fileExists(atPath: path, isDirectory: &isDirectory) return exists && isDirectory.boolValue } - public func resolveHomeDirectoryIn(path: String) -> String { + func resolveHomeDirectoryIn(path: String) -> String { if let first = path.first, first == "~" { return path.replacingCharacters(in: ...path.startIndex, with: FileManager.default.homeDirectoryForCurrentUser.path) diff --git a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProj+Helpers.swift b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProj+Helpers.swift index 45eb446f43..d0d283f5f1 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProj+Helpers.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProj+Helpers.swift @@ -16,7 +16,7 @@ extension XcodeProj { } func getOrCreateGroup(named group: String, in rootGroup: PBXGroup?) throws -> PBXGroup? { - guard let rootGroup = rootGroup else { + guard let rootGroup else { return nil } if let existingGroup = rootGroup.group(named: group) { @@ -39,7 +39,8 @@ extension XcodeProj { // MARK: Add files to project extension XcodeProj { func targets(named targetName: String, - ofType productType: PBXProductType) -> [PBXTarget] { + 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 403ce30a83..78c4ad08b8 100644 --- a/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProject.swift +++ b/AmplifyTools/AmplifyXcode/Sources/AmplifyXcodeCore/Support/XcodeProject.swift @@ -64,12 +64,11 @@ struct XcodeProject { } private func resolveTarget(_ target: XcodeProjectTarget) throws -> PBXTarget { - let targetName: String - switch target { + let targetName: String = switch target { case .primary: - targetName = project.mainProject()?.name ?? "primary" + project.mainProject()?.name ?? "primary" case .named(let name): - targetName = name + name } if let targetRef = project.targets(named: targetName, ofType: .application).first { @@ -84,7 +83,8 @@ struct XcodeProject { extension XcodeProject { func add(files: [XcodeProjectFile], toGroup group: String, - inTarget target: XcodeProjectTarget) throws { + 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 7aa3e807fc..dfdb5428bf 100644 --- a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Commands/CommandImportModelsTasksTests.swift +++ b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Commands/CommandImportModelsTasksTests.swift @@ -41,13 +41,15 @@ class CommandImportModelsTasksTests: XCTestCase { 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/Mocks/MockAmplifyCommandEnvironment.swift b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyCommandEnvironment.swift index a21bb33011..b122dedbee 100644 --- a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyCommandEnvironment.swift +++ b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyCommandEnvironment.swift @@ -69,7 +69,8 @@ class MockAmplifyCommandEnvironment: Mock, AmplifyCommandEnvironment { func addFilesToXcodeProject(projectPath path: String, files: [XcodeProjectFile], toGroup group: String, - inTarget: XcodeProjectTarget) throws { + inTarget: XcodeProjectTarget) throws + { captureCall("addFilesToXcodeProject") } } diff --git a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyFileManager.swift b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyFileManager.swift index 316b0f747d..693762d1dd 100644 --- a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyFileManager.swift +++ b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeCoreTests/Mocks/MockAmplifyFileManager.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import AmplifyXcodeCore +import Foundation class MockAmplifyFileManager: Mock, AmplifyFileManager { func fileExists(atPath filePath: String) -> Bool { diff --git a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeTests/AmplifyXcodeTests.swift b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeTests/AmplifyXcodeTests.swift index 159046c224..94924a98a9 100644 --- a/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeTests/AmplifyXcodeTests.swift +++ b/AmplifyTools/AmplifyXcode/Tests/AmplifyXcodeTests/AmplifyXcodeTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import class Foundation.Bundle +import XCTest final class AmplifyXcodeTests: XCTestCase { func testExecutable() throws { diff --git a/canaries/example/MyAmplifyApp/MyAmplifyAppApp.swift b/canaries/example/MyAmplifyApp/MyAmplifyAppApp.swift index 68eddea3b8..9b60c116a6 100644 --- a/canaries/example/MyAmplifyApp/MyAmplifyAppApp.swift +++ b/canaries/example/MyAmplifyApp/MyAmplifyAppApp.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import SwiftUI import Amplify +import SwiftUI @main