From db4ff4379f8c264d22c8fe272234d26381cee486 Mon Sep 17 00:00:00 2001 From: Marc VandenBerg Date: Mon, 17 Oct 2022 11:12:12 -0400 Subject: [PATCH] Update snapshots for improved pluralization --- .../appsync-java-visitor.test.ts.snap | 70 ++++----- ...appsync-json-metadata-visitor.test.ts.snap | 1 + .../appsync-swift-visitor.test.ts.snap | 33 ++-- .../visitors/appsync-java-visitor.test.ts | 1 + .../visitors/appsync-swift-visitor.test.ts | 147 +++++++++--------- .../appsync-java-visitor.test.ts.snap | 44 +++--- .../appsync-swift-visitor.test.ts.snap | 63 +++++--- 7 files changed, 198 insertions(+), 161 deletions(-) diff --git a/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-java-visitor.test.ts.snap b/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-java-visitor.test.ts.snap index 1c34ee31e..771af5968 100644 --- a/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-java-visitor.test.ts.snap +++ b/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-java-visitor.test.ts.snap @@ -23,7 +23,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Post type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Posts\\", type = Model.Type.USER, version = 1) +@ModelConfig(listPluralName = \\"Posts\\", syncPluralName = \\"Posts\\", type = Model.Type.USER, version = 1) @Index(name = \\"undefined\\", fields = {\\"id\\",\\"title\\"}) public final class Post implements Model { public static final QueryField ID = field(\\"Post\\", \\"id\\"); @@ -205,7 +205,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Comment type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Comments\\", type = Model.Type.USER, version = 1) +@ModelConfig(listPluralName = \\"Comments\\", syncPluralName = \\"Comments\\", type = Model.Type.USER, version = 1) @Index(name = \\"undefined\\", fields = {\\"id\\",\\"content\\"}) public final class Comment implements Model { public static final QueryField ID = field(\\"Comment\\", \\"id\\"); @@ -435,7 +435,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Project type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Projects\\", type = Model.Type.USER, version = 1) +@ModelConfig(listPluralName = \\"Projects\\", syncPluralName = \\"Projects\\", type = Model.Type.USER, version = 1) @Index(name = \\"undefined\\", fields = {\\"projectId\\",\\"name\\"}) public final class Project implements Model { public static final QueryField PROJECT_ID = field(\\"Project\\", \\"projectId\\"); @@ -670,7 +670,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Team type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Teams\\", type = Model.Type.USER, version = 1) +@ModelConfig(listPluralName = \\"Teams\\", syncPluralName = \\"Teams\\", type = Model.Type.USER, version = 1) @Index(name = \\"undefined\\", fields = {\\"teamId\\",\\"name\\"}) public final class Team implements Model { public static final QueryField TEAM_ID = field(\\"Team\\", \\"teamId\\"); @@ -874,7 +874,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the BlogOwnerWithCustomPKS type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"BlogOwnerWithCustomPKS\\", type = Model.Type.USER, version = 1) +@ModelConfig(listPluralName = \\"BlogOwnerWithCustomPKS\\", syncPluralName = \\"BlogOwnerWithCustomPKS\\", type = Model.Type.USER, version = 1) @Index(name = \\"undefined\\", fields = {\\"name\\",\\"wea\\"}) public final class BlogOwnerWithCustomPKS implements Model { public static final QueryField ID = field(\\"BlogOwnerWithCustomPKS\\", \\"id\\"); @@ -1088,7 +1088,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Comment type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Comments\\", type = Model.Type.USER, version = 1) +@ModelConfig(listPluralName = \\"Comments\\", syncPluralName = \\"Comments\\", type = Model.Type.USER, version = 1) @Index(name = \\"undefined\\", fields = {\\"title\\",\\"content\\",\\"likes\\"}) public final class Comment implements Model { public static final QueryField POST = field(\\"Comment\\", \\"postCommentsPostId\\"); @@ -1349,7 +1349,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Post type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Posts\\", type = Model.Type.USER, version = 1) +@ModelConfig(listPluralName = \\"Posts\\", syncPluralName = \\"Posts\\", type = Model.Type.USER, version = 1) @Index(name = \\"undefined\\", fields = {\\"postId\\"}) public final class Post implements Model { public static final QueryField POST_ID = field(\\"Post\\", \\"postId\\"); @@ -1634,7 +1634,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Blog type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Blogs\\", type = Model.Type.USER, version = 1) +@ModelConfig(listPluralName = \\"Blogs\\", syncPluralName = \\"Blogs\\", type = Model.Type.USER, version = 1) public final class Blog implements Model { public static final QueryField ID = field(\\"Blog\\", \\"id\\"); public static final QueryField NAME = field(\\"Blog\\", \\"name\\"); @@ -1845,7 +1845,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Post type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Posts\\") +@ModelConfig(listPluralName = \\"Posts\\", syncPluralName = \\"Posts\\") public final class Post implements Model { public static final QueryField ID = field(\\"Post\\", \\"id\\"); public static final QueryField TITLE = field(\\"Post\\", \\"title\\"); @@ -2024,7 +2024,7 @@ public final class Post implements Model { /** This is an auto generated class representing the Tag type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Tags\\") +@ModelConfig(listPluralName = \\"Tags\\", syncPluralName = \\"Tags\\") public final class Tag implements Model { public static final QueryField ID = field(\\"Tag\\", \\"id\\"); public static final QueryField LABEL = field(\\"Tag\\", \\"label\\"); @@ -2176,7 +2176,7 @@ public final class Tag implements Model { /** This is an auto generated class representing the PostTags type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"PostTags\\") +@ModelConfig(listPluralName = \\"PostTags\\", syncPluralName = \\"PostTags\\") @Index(name = \\"byPost\\", fields = {\\"postID\\"}) @Index(name = \\"byTag\\", fields = {\\"tagID\\"}) public final class PostTags implements Model { @@ -2381,7 +2381,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the customClaim type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"customClaims\\", authRules = { +@ModelConfig(listPluralName = \\"customClaims\\", syncPluralName = \\"customClaims\\", authRules = { @AuthRule(allow = AuthStrategy.OWNER, ownerField = \\"owner\\", identityClaim = \\"user_id\\", provider = \\"userPools\\", operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) public final class customClaim implements Model { @@ -2576,7 +2576,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the customClaim type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"customClaims\\", authRules = { +@ModelConfig(listPluralName = \\"customClaims\\", syncPluralName = \\"customClaims\\", authRules = { @AuthRule(allow = AuthStrategy.GROUPS, groupClaim = \\"user_groups\\", groups = { \\"Moderator\\" }, provider = \\"userPools\\", operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) public final class customClaim implements Model { @@ -2771,7 +2771,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Employee type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Employees\\", authRules = { +@ModelConfig(listPluralName = \\"Employees\\", syncPluralName = \\"Employees\\", authRules = { @AuthRule(allow = AuthStrategy.OWNER, ownerField = \\"owner\\", identityClaim = \\"cognito:username\\", provider = \\"userPools\\", operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }), @AuthRule(allow = AuthStrategy.GROUPS, groupClaim = \\"cognito:groups\\", groups = { \\"Admins\\" }, provider = \\"userPools\\", operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) @@ -3006,7 +3006,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the dynamicGroups type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"dynamicGroups\\", authRules = { +@ModelConfig(listPluralName = \\"dynamicGroups\\", syncPluralName = \\"dynamicGroups\\", authRules = { @AuthRule(allow = AuthStrategy.GROUPS, groupClaim = \\"cognito:groups\\", groupsField = \\"groups\\", provider = \\"userPools\\", operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) public final class dynamicGroups implements Model { @@ -3201,7 +3201,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Employee type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Employees\\", authRules = { +@ModelConfig(listPluralName = \\"Employees\\", syncPluralName = \\"Employees\\", authRules = { @AuthRule(allow = AuthStrategy.OWNER, ownerField = \\"owner\\", identityClaim = \\"cognito:username\\", provider = \\"userPools\\", operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }), @AuthRule(allow = AuthStrategy.PRIVATE, provider = \\"iam\\", operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) @@ -3436,7 +3436,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the simpleOwnerAuth type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"simpleOwnerAuths\\", authRules = { +@ModelConfig(listPluralName = \\"simpleOwnerAuths\\", syncPluralName = \\"simpleOwnerAuths\\", authRules = { @AuthRule(allow = AuthStrategy.OWNER, ownerField = \\"owner\\", identityClaim = \\"cognito:username\\", provider = \\"userPools\\", operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) public final class simpleOwnerAuth implements Model { @@ -3631,7 +3631,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the allowRead type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"allowReads\\", authRules = { +@ModelConfig(listPluralName = \\"allowReads\\", syncPluralName = \\"allowReads\\", authRules = { @AuthRule(allow = AuthStrategy.OWNER, ownerField = \\"owner\\", identityClaim = \\"cognito:username\\", provider = \\"userPools\\", operations = { ModelOperation.CREATE, ModelOperation.DELETE, ModelOperation.UPDATE }) }) public final class allowRead implements Model { @@ -3826,7 +3826,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the privateType type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"privateTypes\\", authRules = { +@ModelConfig(listPluralName = \\"privateTypes\\", syncPluralName = \\"privateTypes\\", authRules = { @AuthRule(allow = AuthStrategy.PRIVATE, operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) public final class privateType implements Model { @@ -4021,7 +4021,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the privateType type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"privateTypes\\", authRules = { +@ModelConfig(listPluralName = \\"privateTypes\\", syncPluralName = \\"privateTypes\\", authRules = { @AuthRule(allow = AuthStrategy.PRIVATE, operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) public final class privateType implements Model { @@ -4218,7 +4218,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the publicType type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"publicTypes\\", authRules = { +@ModelConfig(listPluralName = \\"publicTypes\\", syncPluralName = \\"publicTypes\\", authRules = { @AuthRule(allow = AuthStrategy.PUBLIC, operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) public final class publicType implements Model { @@ -4413,7 +4413,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the staticGroups type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"staticGroups\\", authRules = { +@ModelConfig(listPluralName = \\"staticGroups\\", syncPluralName = \\"staticGroups\\", authRules = { @AuthRule(allow = AuthStrategy.GROUPS, groupClaim = \\"cognito:groups\\", groups = { \\"Admin\\" }, provider = \\"userPools\\", operations = { ModelOperation.CREATE, ModelOperation.UPDATE, ModelOperation.DELETE, ModelOperation.READ }) }) public final class staticGroups implements Model { @@ -4605,7 +4605,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Landmark type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Landmarks\\") +@ModelConfig(listPluralName = \\"Landmarks\\", syncPluralName = \\"Landmarks\\") public final class Landmark implements Model { public static final QueryField ID = field(\\"Landmark\\", \\"id\\"); public static final QueryField NAME = field(\\"Landmark\\", \\"name\\"); @@ -5103,7 +5103,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the task type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"tasks\\") +@ModelConfig(listPluralName = \\"tasks\\", syncPluralName = \\"tasks\\") public final class task implements Model { public static final QueryField ID = field(\\"task\\", \\"id\\"); public static final QueryField TODO = field(\\"task\\", \\"taskTodoId\\"); @@ -5321,7 +5321,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Todo type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Todos\\") +@ModelConfig(listPluralName = \\"Todos\\", syncPluralName = \\"Todos\\") public final class Todo implements Model { public static final QueryField ID = field(\\"Todo\\", \\"id\\"); private final @ModelField(targetType=\\"ID\\", isRequired = true) String id; @@ -5463,7 +5463,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the SimpleModel type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"SimpleModels\\") +@ModelConfig(listPluralName = \\"SimpleModels\\", syncPluralName = \\"SimpleModels\\") public final class SimpleModel implements Model { public static final QueryField ID = field(\\"SimpleModel\\", \\"id\\"); public static final QueryField NAME = field(\\"SimpleModel\\", \\"name\\"); @@ -5653,7 +5653,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the SimpleModel type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"SimpleModels\\") +@ModelConfig(listPluralName = \\"SimpleModels\\", syncPluralName = \\"SimpleModels\\") public final class SimpleModel implements Model { public static final QueryField ID = field(\\"SimpleModel\\", \\"id\\"); public static final QueryField NAME = field(\\"SimpleModel\\", \\"name\\"); @@ -5843,7 +5843,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the ListContainer type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"ListContainers\\") +@ModelConfig(listPluralName = \\"ListContainers\\", syncPluralName = \\"ListContainers\\") public final class ListContainer implements Model { public static final QueryField ID = field(\\"ListContainer\\", \\"id\\"); public static final QueryField NAME = field(\\"ListContainer\\", \\"name\\"); @@ -6498,7 +6498,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the task type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"tasks\\") +@ModelConfig(listPluralName = \\"tasks\\", syncPluralName = \\"tasks\\") public final class task implements Model { public static final QueryField ID = field(\\"task\\", \\"id\\"); public static final QueryField TITLE = field(\\"task\\", \\"title\\"); @@ -6780,7 +6780,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Todo type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Todos\\") +@ModelConfig(listPluralName = \\"Todos\\", syncPluralName = \\"Todos\\") public final class Todo implements Model { public static final QueryField ID = field(\\"Todo\\", \\"id\\"); public static final QueryField TITLE = field(\\"Todo\\", \\"title\\"); @@ -7098,7 +7098,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the TypeWithAWSDateScalars type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"TypeWithAWSDateScalars\\") +@ModelConfig(listPluralName = \\"TypeWithAWSDateScalars\\", syncPluralName = \\"TypeWithAWSDateScalars\\") public final class TypeWithAWSDateScalars implements Model { public static final QueryField ID = field(\\"TypeWithAWSDateScalars\\", \\"id\\"); public static final QueryField DATE = field(\\"TypeWithAWSDateScalars\\", \\"date\\"); @@ -7345,7 +7345,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the authorBook type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"authorBooks\\") +@ModelConfig(listPluralName = \\"authorBooks\\", syncPluralName = \\"authorBooks\\") @Index(name = \\"byAuthor\\", fields = {\\"author_id\\"}) @Index(name = \\"byBook\\", fields = {\\"book_id\\"}) public final class authorBook implements Model { @@ -7601,7 +7601,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the NonCamelCaseField type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"NonCamelCaseFields\\") +@ModelConfig(listPluralName = \\"NonCamelCaseFields\\", syncPluralName = \\"NonCamelCaseFields\\") public final class NonCamelCaseField implements Model { public static final QueryField ID = field(\\"NonCamelCaseField\\", \\"id\\"); public static final QueryField EMPLOYEE_PID = field(\\"NonCamelCaseField\\", \\"employeePID\\"); @@ -7764,7 +7764,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the snake_case type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"snake_cases\\") +@ModelConfig(listPluralName = \\"snake_cases\\", syncPluralName = \\"snake_cases\\") public final class snake_case implements Model { public static final QueryField ID = field(\\"snake_case\\", \\"id\\"); public static final QueryField NAME = field(\\"snake_case\\", \\"name\\"); @@ -7927,7 +7927,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the SnakeCaseField type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"SnakeCaseFields\\") +@ModelConfig(listPluralName = \\"SnakeCaseFields\\", syncPluralName = \\"SnakeCaseFields\\") public final class SnakeCaseField implements Model { public static final QueryField ID = field(\\"SnakeCaseField\\", \\"id\\"); public static final QueryField FIRST_NAME = field(\\"SnakeCaseField\\", \\"first_name\\"); diff --git a/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-json-metadata-visitor.test.ts.snap b/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-json-metadata-visitor.test.ts.snap index c7bebe5be..06d9fa84f 100644 --- a/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-json-metadata-visitor.test.ts.snap +++ b/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-json-metadata-visitor.test.ts.snap @@ -99,6 +99,7 @@ export const schema: Schema = { }, \\"enums\\": {}, \\"nonModels\\": {}, + \\"codegenVersion\\": \\"1.0.0\\", \\"version\\": \\"bf47977135db257ec69466688eea15d5\\" };" `; diff --git a/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-swift-visitor.test.ts.snap b/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-swift-visitor.test.ts.snap index 19620cb6f..bfd22886a 100644 --- a/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-swift-visitor.test.ts.snap +++ b/packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-swift-visitor.test.ts.snap @@ -63,7 +63,8 @@ extension Post { public static let schema = defineSchema { model in let post = Post.keys - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.attributes( .index(fields: [\\"id\\", \\"title\\"], name: nil), @@ -155,7 +156,8 @@ extension Comment { public static let schema = defineSchema { model in let comment = Comment.keys - model.pluralName = \\"Comments\\" + model.listPluralName = \\"Comments\\" + model.syncPluralName = \\"Comments\\" model.attributes( .index(fields: [\\"id\\", \\"content\\"], name: nil), @@ -242,7 +244,8 @@ extension ModelCompositePk { public static let schema = defineSchema { model in let modelCompositePk = ModelCompositePk.keys - model.pluralName = \\"ModelCompositePks\\" + model.listPluralName = \\"ModelCompositePks\\" + model.syncPluralName = \\"ModelCompositePks\\" model.attributes( .index(fields: [\\"id\\", \\"dob\\"], name: nil), @@ -322,7 +325,8 @@ extension ModelExplicitCustomPk { public static let schema = defineSchema { model in let modelExplicitCustomPk = ModelExplicitCustomPk.keys - model.pluralName = \\"ModelExplicitCustomPks\\" + model.listPluralName = \\"ModelExplicitCustomPks\\" + model.syncPluralName = \\"ModelExplicitCustomPks\\" model.attributes( .index(fields: [\\"userId\\"], name: nil), @@ -400,7 +404,8 @@ extension ModelExplicitDefaultPk { public static let schema = defineSchema { model in let modelExplicitDefaultPk = ModelExplicitDefaultPk.keys - model.pluralName = \\"ModelExplicitDefaultPks\\" + model.listPluralName = \\"ModelExplicitDefaultPks\\" + model.syncPluralName = \\"ModelExplicitDefaultPks\\" model.attributes( .index(fields: [\\"id\\"], name: nil), @@ -472,7 +477,8 @@ extension ModelImplicitDefaultPk { public static let schema = defineSchema { model in let modelImplicitDefaultPk = ModelImplicitDefaultPk.keys - model.pluralName = \\"ModelImplicitDefaultPks\\" + model.listPluralName = \\"ModelImplicitDefaultPks\\" + model.syncPluralName = \\"ModelImplicitDefaultPks\\" model.attributes( .primaryKey(fields: [modelImplicitDefaultPk.id]) @@ -561,7 +567,8 @@ extension Project { public static let schema = defineSchema { model in let project = Project.keys - model.pluralName = \\"Projects\\" + model.listPluralName = \\"Projects\\" + model.syncPluralName = \\"Projects\\" model.attributes( .index(fields: [\\"projectId\\", \\"name\\"], name: nil), @@ -649,7 +656,8 @@ extension Team { public static let schema = defineSchema { model in let team = Team.keys - model.pluralName = \\"Teams\\" + model.listPluralName = \\"Teams\\" + model.syncPluralName = \\"Teams\\" model.attributes( .index(fields: [\\"teamId\\", \\"name\\"], name: nil), @@ -771,7 +779,8 @@ extension ListContainer { public static let schema = defineSchema { model in let listContainer = ListContainer.keys - model.pluralName = \\"ListContainers\\" + model.listPluralName = \\"ListContainers\\" + model.syncPluralName = \\"ListContainers\\" model.fields( .id(), @@ -878,7 +887,8 @@ extension Todo { public static let schema = defineSchema { model in let todo = Todo.keys - model.pluralName = \\"Todos\\" + model.listPluralName = \\"Todos\\" + model.syncPluralName = \\"Todos\\" model.fields( .id(), @@ -950,7 +960,8 @@ extension task { public static let schema = defineSchema { model in let task = task.keys - model.pluralName = \\"tasks\\" + model.listPluralName = \\"tasks\\" + model.syncPluralName = \\"tasks\\" model.fields( .id(), diff --git a/packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-java-visitor.test.ts b/packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-java-visitor.test.ts index 0e99a1858..672438404 100644 --- a/packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-java-visitor.test.ts +++ b/packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-java-visitor.test.ts @@ -11,6 +11,7 @@ const defaultJavaVisitorSettings = { transformerVersion: 1, generate: CodeGenGenerateEnum.code, respectPrimaryKeyAttributesOnConnectionField: false, + improvePluralization: true, } const buildSchemaWithDirectives = (schema: String): GraphQLSchema => { return buildSchema([schema, directives, scalars].join('\n')); diff --git a/packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-swift-visitor.test.ts b/packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-swift-visitor.test.ts index 5f0e7c75c..5ed763d42 100644 --- a/packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-swift-visitor.test.ts +++ b/packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-swift-visitor.test.ts @@ -11,7 +11,7 @@ const defaultIosVisitorSetings = { handleListNullabilityTransparently: true, transformerVersion: 1, respectPrimaryKeyAttributesOnConnectionField: false, - improvePluralization: false, + improvePluralization: true, }; const buildSchemaWithDirectives = (schema: String): GraphQLSchema => { return buildSchema([schema, directives, scalars].join('\n')); @@ -118,7 +118,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let simpleModel = SimpleModel.keys - model.pluralName = \\"SimpleModels\\" + model.listPluralName = \\"SimpleModels\\" + model.syncPluralName = \\"SimpleModels\\" model.fields( .id(), @@ -224,7 +225,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let snake_case = snake_case.keys - model.pluralName = \\"snake_cases\\" + model.listPluralName = \\"snake_cases\\" + model.syncPluralName = \\"snake_cases\\" model.fields( .id(), @@ -360,7 +362,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let authorBook = authorBook.keys - model.pluralName = \\"authorBooks\\" + model.listPluralName = \\"authorBooks\\" + model.syncPluralName = \\"authorBooks\\" model.attributes( .index(fields: [\\"author_id\\"], name: \\"byAuthor\\"), @@ -638,7 +641,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let todo = Todo.keys - model.pluralName = \\"Todos\\" + model.listPluralName = \\"Todos\\" + model.syncPluralName = \\"Todos\\" model.fields( .id(), @@ -736,7 +740,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let task = task.keys - model.pluralName = \\"tasks\\" + model.listPluralName = \\"tasks\\" + model.syncPluralName = \\"tasks\\" model.fields( .id(), @@ -872,7 +877,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let post = Post.keys - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -943,7 +949,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let post = Post.keys - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1059,7 +1066,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let objectWithNativeTypes = ObjectWithNativeTypes.keys - model.pluralName = \\"ObjectWithNativeTypes\\" + model.listPluralName = \\"ObjectWithNativeTypes\\" + model.syncPluralName = \\"ObjectWithNativeTypes\\" model.fields( .id(), @@ -1181,7 +1189,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let attraction = Attraction.keys - model.pluralName = \\"Attractions\\" + model.listPluralName = \\"Attractions\\" + model.syncPluralName = \\"Attractions\\" model.fields( .id(), @@ -1243,7 +1252,8 @@ describe('AppSyncSwiftVisitor', () => { public static let schema = defineSchema { model in let location = Location.keys - model.pluralName = \\"Locations\\" + model.listPluralName = \\"Locations\\" + model.syncPluralName = \\"Locations\\" model.fields( .field(location.lat, is: .required, ofType: .string), @@ -1430,7 +1440,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .owner, ownerField: \\"owner\\", identityClaim: \\"cognito:username\\", provider: .userPools, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1479,7 +1490,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .owner, ownerField: \\"author\\", identityClaim: \\"cognito:username\\", provider: .userPools, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1529,7 +1541,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .owner, ownerField: \\"author\\", identityClaim: \\"cognito:username\\", provider: .userPools, operations: [.create, .update, .delete]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1579,7 +1592,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .owner, ownerField: \\"author\\", identityClaim: \\"sub\\", provider: .userPools, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1626,7 +1640,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .owner, ownerField: \\"owner\\", identityClaim: \\"cognito:username\\", provider: .userPools, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1672,7 +1687,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .owner, ownerField: \\"customField\\", identityClaim: \\"cognito:username\\", provider: .userPools, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1725,7 +1741,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .owner, ownerField: \\"editors\\", identityClaim: \\"cognito:username\\", provider: .userPools, operations: [.update, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1778,7 +1795,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .groups, groupClaim: \\"cognito:groups\\", groups: [\\"Admins\\"], provider: .userPools, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Employees\\" + model.listPluralName = \\"Employees\\" + model.syncPluralName = \\"Employees\\" model.fields( .id(), @@ -1829,7 +1847,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .groups, groupClaim: \\"cognito:groups\\", groups: [\\"admin\\", \\"editors\\"], provider: .userPools, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1877,7 +1896,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .groups, groupClaim: \\"cognito:groups\\", groupsField: \\"groups\\", provider: .userPools, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1925,7 +1945,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .groups, groupClaim: \\"cognito:groups\\", groups: [\\"admin\\"], provider: .userPools, operations: [.create, .update, .delete]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1972,7 +1993,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .groups, groupClaim: \\"custom:groups\\", groups: [\\"admin\\"], provider: .userPools, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -2018,7 +2040,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .private, operations: [.create, .update, .delete, .read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -2077,7 +2100,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .public, operations: [.read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -2137,7 +2161,8 @@ describe('AppSyncSwiftVisitor', () => { rule(allow: .public, provider: .apiKey, operations: [.read]) ] - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -2284,71 +2309,49 @@ describe('AppSyncSwiftVisitor', () => { let wishSchema: string; beforeEach(() => { wishSchema = /* GraphQL */ ` - type NoteData - @model - { - id: ID! - name: String! - description: String - image: String + type NoteData @model { + id: ID! + name: String! + description: String + image: String } - - type Wishes @model - @key(name: "byUsers", fields: ["idUser"]) - { - + + type Wishes @model @key(name: "byUsers", fields: ["idUser"]) { id: ID! date: AWSDateTime! idUser: ID! - ev: ID! - deprecated: Boolean! - owner: String + ev: ID! + deprecated: Boolean! + owner: String } - - type Wish @model - @key(name: "byUsers", fields: ["idUser"]) { - + + type Wish @model @key(name: "byUsers", fields: ["idUser"]) { id: ID! date: AWSDateTime! idUser: ID! - ev: ID! - deprecated: Boolean! - owner: String + ev: ID! + deprecated: Boolean! + owner: String } `; }); it('Should work with potentially pluralized collision', () => { - const visitor = getVisitor( - wishSchema, - 'Wish', - CodeGenGenerateEnum.code, - { - improvePluralization: true, - }, - ); + const visitor = getVisitor(wishSchema, 'Wish', CodeGenGenerateEnum.code, { + improvePluralization: true, + }); const generatedCode = visitor.generate(); expect(generatedCode).toMatchSnapshot(); - const metadataVisitor = getVisitor( - wishSchema, - 'Wish', - CodeGenGenerateEnum.metadata, - { - improvePluralization: true, - }, - ); + const metadataVisitor = getVisitor(wishSchema, 'Wish', CodeGenGenerateEnum.metadata, { + improvePluralization: true, + }); const generatedMetadata = metadataVisitor.generate(); expect(generatedMetadata).toMatchSnapshot(); - const customTypeVisitor = getVisitor( - wishSchema, - 'Wishes', - CodeGenGenerateEnum.code, - { - improvePluralization: true, - }, - ); + const customTypeVisitor = getVisitor(wishSchema, 'Wishes', CodeGenGenerateEnum.code, { + improvePluralization: true, + }); expect(customTypeVisitor.generate()).toMatchSnapshot(); }); }); diff --git a/packages/appsync-modelgen-plugin/src/__tests__/visitors/gqlv2-regression-tests/__snapshots__/appsync-java-visitor.test.ts.snap b/packages/appsync-modelgen-plugin/src/__tests__/visitors/gqlv2-regression-tests/__snapshots__/appsync-java-visitor.test.ts.snap index 9003768aa..54c145750 100644 --- a/packages/appsync-modelgen-plugin/src/__tests__/visitors/gqlv2-regression-tests/__snapshots__/appsync-java-visitor.test.ts.snap +++ b/packages/appsync-modelgen-plugin/src/__tests__/visitors/gqlv2-regression-tests/__snapshots__/appsync-java-visitor.test.ts.snap @@ -22,7 +22,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Post type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Posts\\") +@ModelConfig(listPluralName = \\"Posts\\", syncPluralName = \\"Posts\\") public final class Post implements Model { public static final QueryField ID = field(\\"Post\\", \\"id\\"); public static final QueryField TITLE = field(\\"Post\\", \\"title\\"); @@ -196,7 +196,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Comment type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Comments\\") +@ModelConfig(listPluralName = \\"Comments\\", syncPluralName = \\"Comments\\") @Index(name = \\"byPost\\", fields = {\\"postID\\",\\"content\\"}) public final class Comment implements Model { public static final QueryField ID = field(\\"Comment\\", \\"id\\"); @@ -393,7 +393,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Project2 type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Project2s\\") +@ModelConfig(listPluralName = \\"Project2s\\", syncPluralName = \\"Project2s\\") public final class Project2 implements Model { public static final QueryField ID = field(\\"Project2\\", \\"id\\"); public static final QueryField NAME = field(\\"Project2\\", \\"name\\"); @@ -589,7 +589,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Team2 type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Team2s\\") +@ModelConfig(listPluralName = \\"Team2s\\", syncPluralName = \\"Team2s\\") public final class Team2 implements Model { public static final QueryField ID = field(\\"Team2\\", \\"id\\"); public static final QueryField NAME = field(\\"Team2\\", \\"name\\"); @@ -785,7 +785,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Blog7V2 type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Blog7V2s\\") +@ModelConfig(listPluralName = \\"Blog7V2s\\", syncPluralName = \\"Blog7V2s\\") public final class Blog7V2 implements Model { public static final QueryField ID = field(\\"Blog7V2\\", \\"id\\"); public static final QueryField NAME = field(\\"Blog7V2\\", \\"name\\"); @@ -960,7 +960,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Post7V2 type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Post7V2s\\") +@ModelConfig(listPluralName = \\"Post7V2s\\", syncPluralName = \\"Post7V2s\\") public final class Post7V2 implements Model { public static final QueryField ID = field(\\"Post7V2\\", \\"id\\"); public static final QueryField TITLE = field(\\"Post7V2\\", \\"title\\"); @@ -1161,7 +1161,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Comment7V2 type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Comment7V2s\\") +@ModelConfig(listPluralName = \\"Comment7V2s\\", syncPluralName = \\"Comment7V2s\\") public final class Comment7V2 implements Model { public static final QueryField ID = field(\\"Comment7V2\\", \\"id\\"); public static final QueryField CONTENT = field(\\"Comment7V2\\", \\"content\\"); @@ -1352,7 +1352,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Project type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Projects\\") +@ModelConfig(listPluralName = \\"Projects\\", syncPluralName = \\"Projects\\") public final class Project implements Model { public static final QueryField ID = field(\\"Project\\", \\"id\\"); public static final QueryField NAME = field(\\"Project\\", \\"name\\"); @@ -1548,7 +1548,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Team type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Teams\\") +@ModelConfig(listPluralName = \\"Teams\\", syncPluralName = \\"Teams\\") public final class Team implements Model { public static final QueryField ID = field(\\"Team\\", \\"id\\"); public static final QueryField NAME = field(\\"Team\\", \\"name\\"); @@ -1744,7 +1744,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Post type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Posts\\") +@ModelConfig(listPluralName = \\"Posts\\", syncPluralName = \\"Posts\\") public final class Post implements Model { public static final QueryField ID = field(\\"Post\\", \\"id\\"); public static final QueryField TITLE = field(\\"Post\\", \\"title\\"); @@ -1945,7 +1945,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Tag type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Tags\\") +@ModelConfig(listPluralName = \\"Tags\\", syncPluralName = \\"Tags\\") public final class Tag implements Model { public static final QueryField ID = field(\\"Tag\\", \\"id\\"); public static final QueryField LABEL = field(\\"Tag\\", \\"label\\"); @@ -2118,7 +2118,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Todo type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Todos\\") +@ModelConfig(listPluralName = \\"Todos\\", syncPluralName = \\"Todos\\") public final class Todo implements Model { public static final QueryField ID = field(\\"Todo\\", \\"id\\"); public static final QueryField CONTENT = field(\\"Todo\\", \\"content\\"); @@ -2282,7 +2282,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Post2 type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Post2s\\") +@ModelConfig(listPluralName = \\"Post2s\\", syncPluralName = \\"Post2s\\") public final class Post2 implements Model { public static final QueryField ID = field(\\"Post2\\", \\"id\\"); public static final QueryField TITLE = field(\\"Post2\\", \\"title\\"); @@ -2455,7 +2455,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Comment2 type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Comment2s\\") +@ModelConfig(listPluralName = \\"Comment2s\\", syncPluralName = \\"Comment2s\\") @Index(name = \\"byPost\\", fields = {\\"postID\\",\\"content\\"}) public final class Comment2 implements Model { public static final QueryField ID = field(\\"Comment2\\", \\"id\\"); @@ -2657,7 +2657,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Project2 type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Project2s\\") +@ModelConfig(listPluralName = \\"Project2s\\", syncPluralName = \\"Project2s\\") public final class Project2 implements Model { public static final QueryField ID = field(\\"Project2\\", \\"id\\"); public static final QueryField NAME = field(\\"Project2\\", \\"name\\"); @@ -2852,7 +2852,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Team2 type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Team2s\\") +@ModelConfig(listPluralName = \\"Team2s\\", syncPluralName = \\"Team2s\\") public final class Team2 implements Model { public static final QueryField ID = field(\\"Team2\\", \\"id\\"); public static final QueryField NAME = field(\\"Team2\\", \\"name\\"); @@ -3021,7 +3021,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Post type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Posts\\") +@ModelConfig(listPluralName = \\"Posts\\", syncPluralName = \\"Posts\\") public final class Post implements Model { public static final QueryField ID = field(\\"Post\\", \\"id\\"); public static final QueryField TITLE = field(\\"Post\\", \\"title\\"); @@ -3194,7 +3194,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Comment type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Comments\\") +@ModelConfig(listPluralName = \\"Comments\\", syncPluralName = \\"Comments\\") public final class Comment implements Model { public static final QueryField ID = field(\\"Comment\\", \\"id\\"); public static final QueryField CONTENT = field(\\"Comment\\", \\"content\\"); @@ -3390,7 +3390,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Project type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Projects\\") +@ModelConfig(listPluralName = \\"Projects\\", syncPluralName = \\"Projects\\") public final class Project implements Model { public static final QueryField ID = field(\\"Project\\", \\"id\\"); public static final QueryField NAME = field(\\"Project\\", \\"name\\"); @@ -3585,7 +3585,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Team type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Teams\\") +@ModelConfig(listPluralName = \\"Teams\\", syncPluralName = \\"Teams\\") public final class Team implements Model { public static final QueryField ID = field(\\"Team\\", \\"id\\"); public static final QueryField NAME = field(\\"Team\\", \\"name\\"); @@ -3753,7 +3753,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Customer type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Customers\\") +@ModelConfig(listPluralName = \\"Customers\\", syncPluralName = \\"Customers\\") @Index(name = \\"byRepresentative\\", fields = {\\"accountRepresentativeID\\"}) public final class Customer implements Model { public static final QueryField ID = field(\\"Customer\\", \\"id\\"); @@ -3981,7 +3981,7 @@ import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Customer type in your schema. */ @SuppressWarnings(\\"all\\") -@ModelConfig(pluralName = \\"Customers\\") +@ModelConfig(listPluralName = \\"Customers\\", syncPluralName = \\"Customers\\") @Index(name = \\"byRepresentative\\", fields = {\\"accountRepresentativeID\\"}) public final class Customer implements Model { public static final QueryField ID = field(\\"Customer\\", \\"id\\"); diff --git a/packages/appsync-modelgen-plugin/src/__tests__/visitors/gqlv2-regression-tests/__snapshots__/appsync-swift-visitor.test.ts.snap b/packages/appsync-modelgen-plugin/src/__tests__/visitors/gqlv2-regression-tests/__snapshots__/appsync-swift-visitor.test.ts.snap index abe0b15c2..682d14457 100644 --- a/packages/appsync-modelgen-plugin/src/__tests__/visitors/gqlv2-regression-tests/__snapshots__/appsync-swift-visitor.test.ts.snap +++ b/packages/appsync-modelgen-plugin/src/__tests__/visitors/gqlv2-regression-tests/__snapshots__/appsync-swift-visitor.test.ts.snap @@ -56,7 +56,8 @@ extension Post { public static let schema = defineSchema { model in let post = Post.keys - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -125,7 +126,8 @@ extension Comment { public static let schema = defineSchema { model in let comment = Comment.keys - model.pluralName = \\"Comments\\" + model.listPluralName = \\"Comments\\" + model.syncPluralName = \\"Comments\\" model.attributes( .index(fields: [\\"postID\\", \\"content\\"], name: \\"byPost\\") @@ -204,7 +206,8 @@ extension Project2 { public static let schema = defineSchema { model in let project2 = Project2.keys - model.pluralName = \\"Project2s\\" + model.listPluralName = \\"Project2s\\" + model.syncPluralName = \\"Project2s\\" model.fields( .id(), @@ -274,7 +277,8 @@ extension Team2 { public static let schema = defineSchema { model in let team2 = Team2.keys - model.pluralName = \\"Team2s\\" + model.listPluralName = \\"Team2s\\" + model.syncPluralName = \\"Team2s\\" model.fields( .id(), @@ -343,7 +347,8 @@ extension Blog7V2 { public static let schema = defineSchema { model in let blog7V2 = Blog7V2.keys - model.pluralName = \\"Blog7V2s\\" + model.listPluralName = \\"Blog7V2s\\" + model.syncPluralName = \\"Blog7V2s\\" model.fields( .id(), @@ -418,7 +423,8 @@ extension Post7V2 { public static let schema = defineSchema { model in let post7V2 = Post7V2.keys - model.pluralName = \\"Post7V2s\\" + model.listPluralName = \\"Post7V2s\\" + model.syncPluralName = \\"Post7V2s\\" model.fields( .id(), @@ -488,7 +494,8 @@ extension Comment7V2 { public static let schema = defineSchema { model in let comment7V2 = Comment7V2.keys - model.pluralName = \\"Comment7V2s\\" + model.listPluralName = \\"Comment7V2s\\" + model.syncPluralName = \\"Comment7V2s\\" model.fields( .id(), @@ -563,7 +570,8 @@ extension Project { public static let schema = defineSchema { model in let project = Project.keys - model.pluralName = \\"Projects\\" + model.listPluralName = \\"Projects\\" + model.syncPluralName = \\"Projects\\" model.fields( .id(), @@ -633,7 +641,8 @@ extension Team { public static let schema = defineSchema { model in let team = Team.keys - model.pluralName = \\"Teams\\" + model.listPluralName = \\"Teams\\" + model.syncPluralName = \\"Teams\\" model.fields( .id(), @@ -708,7 +717,8 @@ extension Post { public static let schema = defineSchema { model in let post = Post.keys - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -778,7 +788,8 @@ extension Tag { public static let schema = defineSchema { model in let tag = Tag.keys - model.pluralName = \\"Tags\\" + model.listPluralName = \\"Tags\\" + model.syncPluralName = \\"Tags\\" model.fields( .id(), @@ -841,7 +852,8 @@ extension Todo { public static let schema = defineSchema { model in let todo = Todo.keys - model.pluralName = \\"Todos\\" + model.listPluralName = \\"Todos\\" + model.syncPluralName = \\"Todos\\" model.fields( .id(), @@ -909,7 +921,8 @@ extension Post2 { public static let schema = defineSchema { model in let post2 = Post2.keys - model.pluralName = \\"Post2s\\" + model.listPluralName = \\"Post2s\\" + model.syncPluralName = \\"Post2s\\" model.fields( .id(), @@ -978,7 +991,8 @@ extension Comment2 { public static let schema = defineSchema { model in let comment2 = Comment2.keys - model.pluralName = \\"Comment2s\\" + model.listPluralName = \\"Comment2s\\" + model.syncPluralName = \\"Comment2s\\" model.attributes( .index(fields: [\\"postID\\", \\"content\\"], name: \\"byPost\\") @@ -1057,7 +1071,8 @@ extension Project2 { public static let schema = defineSchema { model in let project2 = Project2.keys - model.pluralName = \\"Project2s\\" + model.listPluralName = \\"Project2s\\" + model.syncPluralName = \\"Project2s\\" model.fields( .id(), @@ -1121,7 +1136,8 @@ extension Team2 { public static let schema = defineSchema { model in let team2 = Team2.keys - model.pluralName = \\"Team2s\\" + model.listPluralName = \\"Team2s\\" + model.syncPluralName = \\"Team2s\\" model.fields( .id(), @@ -1189,7 +1205,8 @@ extension Post { public static let schema = defineSchema { model in let post = Post.keys - model.pluralName = \\"Posts\\" + model.listPluralName = \\"Posts\\" + model.syncPluralName = \\"Posts\\" model.fields( .id(), @@ -1258,7 +1275,8 @@ extension Comment { public static let schema = defineSchema { model in let comment = Comment.keys - model.pluralName = \\"Comments\\" + model.listPluralName = \\"Comments\\" + model.syncPluralName = \\"Comments\\" model.fields( .id(), @@ -1333,7 +1351,8 @@ extension Project { public static let schema = defineSchema { model in let project = Project.keys - model.pluralName = \\"Projects\\" + model.listPluralName = \\"Projects\\" + model.syncPluralName = \\"Projects\\" model.fields( .id(), @@ -1397,7 +1416,8 @@ extension Team { public static let schema = defineSchema { model in let team = Team.keys - model.pluralName = \\"Teams\\" + model.listPluralName = \\"Teams\\" + model.syncPluralName = \\"Teams\\" model.fields( .id(), @@ -1471,7 +1491,8 @@ extension Customer { public static let schema = defineSchema { model in let customer = Customer.keys - model.pluralName = \\"Customers\\" + model.listPluralName = \\"Customers\\" + model.syncPluralName = \\"Customers\\" model.attributes( .index(fields: [\\"accountRepresentativeID\\"], name: \\"byRepresentative\\")