From 464b93f025da95f094e753531801241bc2d82079 Mon Sep 17 00:00:00 2001 From: lazpavel <85319655+lazpavel@users.noreply.github.com> Date: Tue, 10 Aug 2021 16:23:06 -0400 Subject: [PATCH 1/6] fix(graphql-model-transformer): fixed update and create input field type known model types filtering --- .../model-transformer.test.ts.snap | 191 ++++++++++++++++++ .../src/__tests__/model-transformer.test.ts | 31 ++- .../src/graphql-types/mutation.ts | 8 +- 3 files changed, 225 insertions(+), 5 deletions(-) diff --git a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap index eb3b019d121..8c37f331e15 100644 --- a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap +++ b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap @@ -1,5 +1,196 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`ModelTransformer: should filter known input types from create and update input fields 1`] = ` +" +type Test { + id: ID! + email: Email + createdAt: AWSDateTime! + updatedAt: AWSDateTime! +} + +type Email { + id: ID! + createdAt: AWSDateTime! + updatedAt: AWSDateTime! +} + +input ModelStringInput { + ne: String + eq: String + le: String + lt: String + ge: String + gt: String + contains: String + notContains: String + between: [String] + beginsWith: String + attributeExists: Boolean + attributeType: ModelAttributeTypes + size: ModelSizeInput +} + +input ModelIntInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelFloatInput { + ne: Float + eq: Float + le: Float + lt: Float + ge: Float + gt: Float + between: [Float] + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelBooleanInput { + ne: Boolean + eq: Boolean + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelIDInput { + ne: ID + eq: ID + le: ID + lt: ID + ge: ID + gt: ID + contains: ID + notContains: ID + between: [ID] + beginsWith: ID + attributeExists: Boolean + attributeType: ModelAttributeTypes + size: ModelSizeInput +} + +enum ModelAttributeTypes { + binary + binarySet + bool + list + map + number + numberSet + string + stringSet + _null +} + +input ModelSizeInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] +} + +type Query { + getTest(id: ID!): Test + listTests(filter: ModelTestFilterInput, limit: Int, nextToken: String): ModelTestConnection + getEmail(id: ID!): Email + listEmails(filter: ModelEmailFilterInput, limit: Int, nextToken: String): ModelEmailConnection +} + +type ModelTestConnection { + items: [Test] + nextToken: String +} + +input ModelTestFilterInput { + id: ModelIDInput + and: [ModelTestFilterInput] + or: [ModelTestFilterInput] + not: ModelTestFilterInput +} + +input ModelTestConditionInput { + id: ModelIDInput + and: [ModelTestConditionInput] + or: [ModelTestConditionInput] + not: ModelTestConditionInput +} + +input CreateTestInput { + id: ID +} + +type Mutation { + createTest(input: CreateTestInput!, condition: ModelTestConditionInput): Test + updateTest(input: UpdateTestInput!, condition: ModelTestConditionInput): Test + deleteTest(input: DeleteTestInput!, condition: ModelTestConditionInput): Test + createEmail(input: CreateEmailInput!, condition: ModelEmailConditionInput): Email + updateEmail(input: UpdateEmailInput!, condition: ModelEmailConditionInput): Email + deleteEmail(input: DeleteEmailInput!, condition: ModelEmailConditionInput): Email +} + +input UpdateTestInput { + id: ID! +} + +input DeleteTestInput { + id: ID! +} + +type Subscription { + onCreateTest: Test @aws_subscribe(mutations: [\\"createTest\\"]) + onUpdateTest: Test @aws_subscribe(mutations: [\\"updateTest\\"]) + onDeleteTest: Test @aws_subscribe(mutations: [\\"deleteTest\\"]) + onCreateEmail: Email @aws_subscribe(mutations: [\\"createEmail\\"]) + onUpdateEmail: Email @aws_subscribe(mutations: [\\"updateEmail\\"]) + onDeleteEmail: Email @aws_subscribe(mutations: [\\"deleteEmail\\"]) +} + +type ModelEmailConnection { + items: [Email] + nextToken: String +} + +input ModelEmailFilterInput { + id: ModelIDInput + and: [ModelEmailFilterInput] + or: [ModelEmailFilterInput] + not: ModelEmailFilterInput +} + +input ModelEmailConditionInput { + id: ModelIDInput + and: [ModelEmailConditionInput] + or: [ModelEmailConditionInput] + not: ModelEmailConditionInput +} + +input CreateEmailInput { + id: ID +} + +input UpdateEmailInput { + id: ID! +} + +input DeleteEmailInput { + id: ID! +} + +" +`; + exports[`ModelTransformer: should not add default primary key when ID is defined 1`] = ` "## [Start] Create Request template. ** ## Begin - key condition ** diff --git a/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts b/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts index f373df72e2a..99d9eb0973c 100644 --- a/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts +++ b/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts @@ -435,7 +435,36 @@ describe('ModelTransformer: ', () => { const createTestInput = getInputType(parsed, 'CreateTestInput'); expectFieldsOnInputType(createTestInput!, ['status', 'lastStatus']); - const updateTestInput = getInputType(parsed, 'CreateTestInput'); + const updateTestInput = getInputType(parsed, 'UpdateTestInput'); expectFieldsOnInputType(updateTestInput!, ['status', 'lastStatus']); }); + + it('should filter known input types from create and update input fields', () => { + const validSchema = ` + type Test @model { + id: ID! + email: Email + } + + type Email @model { + id: ID! + } + `; + const transformer = new GraphQLTransform({ + transformers: [new ModelTransformer()], + featureFlags, + }); + const result = transformer.transform(validSchema); + expect(result).toBeDefined(); + expect(result.schema).toBeDefined(); + expect(result.schema).toMatchSnapshot(); + const schema = parse(result.schema); + validateModelSchema(schema); + + const createTestInput = getInputType(schema, 'CreateTestInput'); + expect(getFieldOnInputType(createTestInput!, 'email')).toBeUndefined(); + + const updateTestInput = getInputType(schema, 'UpdateTestInput'); + expect(getFieldOnInputType(updateTestInput!, 'email')).toBeUndefined(); + }); }); diff --git a/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts b/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts index 4e9a5828fa2..77287c0b448 100644 --- a/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts +++ b/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts @@ -1,8 +1,8 @@ import { TransformerTransformSchemaStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces'; -import { ObjectTypeDefinitionNode, InputObjectTypeDefinitionNode, DocumentNode } from 'graphql'; +import { DocumentNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode } from 'graphql'; import { ModelResourceIDs, toPascalCase } from 'graphql-transformer-common'; import { ModelDirectiveConfiguration } from '../graphql-model-transformer'; -import { ObjectDefinitionWrapper, InputObjectDefinitionWrapper, InputFieldWrapper } from '../wrappers/object-definition-wrapper'; +import { InputFieldWrapper, InputObjectDefinitionWrapper, ObjectDefinitionWrapper } from '../wrappers/object-definition-wrapper'; import { makeConditionFilterInput } from './common'; /** @@ -30,7 +30,7 @@ export const makeUpdateInputField = ( return false; }) .map(field => { - return field.getTypeName(); + return field.name; }); const objectTypeDefinition: ObjectTypeDefinitionNode = { @@ -103,7 +103,7 @@ export const makeCreateInputField = ( return false; }) .map(field => { - return field.getTypeName(); + return field.name; }); const objectTypeDefinition: ObjectTypeDefinitionNode = { From d5f308592e9ba14193ef85ef9607aac1d3ee408c Mon Sep 17 00:00:00 2001 From: lazpavel <85319655+lazpavel@users.noreply.github.com> Date: Tue, 10 Aug 2021 16:23:06 -0400 Subject: [PATCH 2/6] fix(graphql-model-transformer): fixed update and create input field type known model types filtering --- .../model-transformer.test.ts.snap | 191 ++++++++++++++++++ .../src/__tests__/model-transformer.test.ts | 32 ++- .../src/graphql-types/mutation.ts | 8 +- 3 files changed, 226 insertions(+), 5 deletions(-) diff --git a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap index eb3b019d121..8c37f331e15 100644 --- a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap +++ b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap @@ -1,5 +1,196 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`ModelTransformer: should filter known input types from create and update input fields 1`] = ` +" +type Test { + id: ID! + email: Email + createdAt: AWSDateTime! + updatedAt: AWSDateTime! +} + +type Email { + id: ID! + createdAt: AWSDateTime! + updatedAt: AWSDateTime! +} + +input ModelStringInput { + ne: String + eq: String + le: String + lt: String + ge: String + gt: String + contains: String + notContains: String + between: [String] + beginsWith: String + attributeExists: Boolean + attributeType: ModelAttributeTypes + size: ModelSizeInput +} + +input ModelIntInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelFloatInput { + ne: Float + eq: Float + le: Float + lt: Float + ge: Float + gt: Float + between: [Float] + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelBooleanInput { + ne: Boolean + eq: Boolean + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelIDInput { + ne: ID + eq: ID + le: ID + lt: ID + ge: ID + gt: ID + contains: ID + notContains: ID + between: [ID] + beginsWith: ID + attributeExists: Boolean + attributeType: ModelAttributeTypes + size: ModelSizeInput +} + +enum ModelAttributeTypes { + binary + binarySet + bool + list + map + number + numberSet + string + stringSet + _null +} + +input ModelSizeInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] +} + +type Query { + getTest(id: ID!): Test + listTests(filter: ModelTestFilterInput, limit: Int, nextToken: String): ModelTestConnection + getEmail(id: ID!): Email + listEmails(filter: ModelEmailFilterInput, limit: Int, nextToken: String): ModelEmailConnection +} + +type ModelTestConnection { + items: [Test] + nextToken: String +} + +input ModelTestFilterInput { + id: ModelIDInput + and: [ModelTestFilterInput] + or: [ModelTestFilterInput] + not: ModelTestFilterInput +} + +input ModelTestConditionInput { + id: ModelIDInput + and: [ModelTestConditionInput] + or: [ModelTestConditionInput] + not: ModelTestConditionInput +} + +input CreateTestInput { + id: ID +} + +type Mutation { + createTest(input: CreateTestInput!, condition: ModelTestConditionInput): Test + updateTest(input: UpdateTestInput!, condition: ModelTestConditionInput): Test + deleteTest(input: DeleteTestInput!, condition: ModelTestConditionInput): Test + createEmail(input: CreateEmailInput!, condition: ModelEmailConditionInput): Email + updateEmail(input: UpdateEmailInput!, condition: ModelEmailConditionInput): Email + deleteEmail(input: DeleteEmailInput!, condition: ModelEmailConditionInput): Email +} + +input UpdateTestInput { + id: ID! +} + +input DeleteTestInput { + id: ID! +} + +type Subscription { + onCreateTest: Test @aws_subscribe(mutations: [\\"createTest\\"]) + onUpdateTest: Test @aws_subscribe(mutations: [\\"updateTest\\"]) + onDeleteTest: Test @aws_subscribe(mutations: [\\"deleteTest\\"]) + onCreateEmail: Email @aws_subscribe(mutations: [\\"createEmail\\"]) + onUpdateEmail: Email @aws_subscribe(mutations: [\\"updateEmail\\"]) + onDeleteEmail: Email @aws_subscribe(mutations: [\\"deleteEmail\\"]) +} + +type ModelEmailConnection { + items: [Email] + nextToken: String +} + +input ModelEmailFilterInput { + id: ModelIDInput + and: [ModelEmailFilterInput] + or: [ModelEmailFilterInput] + not: ModelEmailFilterInput +} + +input ModelEmailConditionInput { + id: ModelIDInput + and: [ModelEmailConditionInput] + or: [ModelEmailConditionInput] + not: ModelEmailConditionInput +} + +input CreateEmailInput { + id: ID +} + +input UpdateEmailInput { + id: ID! +} + +input DeleteEmailInput { + id: ID! +} + +" +`; + exports[`ModelTransformer: should not add default primary key when ID is defined 1`] = ` "## [Start] Create Request template. ** ## Begin - key condition ** diff --git a/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts b/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts index e16b304aff8..21cd04592d4 100644 --- a/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts +++ b/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts @@ -518,7 +518,7 @@ describe('ModelTransformer: ', () => { const createTestInput = getInputType(parsed, 'CreateTestInput'); expectFieldsOnInputType(createTestInput!, ['status', 'lastStatus']); - const updateTestInput = getInputType(parsed, 'CreateTestInput'); + const updateTestInput = getInputType(parsed, 'UpdateTestInput'); expectFieldsOnInputType(updateTestInput!, ['status', 'lastStatus']); }); @@ -630,6 +630,7 @@ describe('ModelTransformer: ', () => { transformers: [new ModelTransformer()], featureFlags, }); + const out = transformer.transform(validSchema); expect(out).toBeDefined(); const definition = out.schema; @@ -649,5 +650,34 @@ describe('ModelTransformer: ', () => { expect(mutList).toContain('createPost'); expect(mutList).toContain('updatePost'); expect(mutList).toContain('deletePost'); + + it('should filter known input types from create and update input fields', () => { + const validSchema = ` + type Test @model { + id: ID! + email: Email + } + + type Email @model { + id: ID! + } + `; + const transformer = new GraphQLTransform({ + transformers: [new ModelTransformer()], + featureFlags, + }); + + const result = transformer.transform(validSchema); + expect(result).toBeDefined(); + expect(result.schema).toBeDefined(); + expect(result.schema).toMatchSnapshot(); + const schema = parse(result.schema); + validateModelSchema(schema); + + const createTestInput = getInputType(schema, 'CreateTestInput'); + expect(getFieldOnInputType(createTestInput!, 'email')).toBeUndefined(); + + const updateTestInput = getInputType(schema, 'UpdateTestInput'); + expect(getFieldOnInputType(updateTestInput!, 'email')).toBeUndefined(); }); }); diff --git a/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts b/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts index 4e9a5828fa2..77287c0b448 100644 --- a/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts +++ b/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts @@ -1,8 +1,8 @@ import { TransformerTransformSchemaStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces'; -import { ObjectTypeDefinitionNode, InputObjectTypeDefinitionNode, DocumentNode } from 'graphql'; +import { DocumentNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode } from 'graphql'; import { ModelResourceIDs, toPascalCase } from 'graphql-transformer-common'; import { ModelDirectiveConfiguration } from '../graphql-model-transformer'; -import { ObjectDefinitionWrapper, InputObjectDefinitionWrapper, InputFieldWrapper } from '../wrappers/object-definition-wrapper'; +import { InputFieldWrapper, InputObjectDefinitionWrapper, ObjectDefinitionWrapper } from '../wrappers/object-definition-wrapper'; import { makeConditionFilterInput } from './common'; /** @@ -30,7 +30,7 @@ export const makeUpdateInputField = ( return false; }) .map(field => { - return field.getTypeName(); + return field.name; }); const objectTypeDefinition: ObjectTypeDefinitionNode = { @@ -103,7 +103,7 @@ export const makeCreateInputField = ( return false; }) .map(field => { - return field.getTypeName(); + return field.name; }); const objectTypeDefinition: ObjectTypeDefinitionNode = { From 90018b91ee0179edcae7ce6e5bdcb4c6364b7e76 Mon Sep 17 00:00:00 2001 From: lazpavel <85319655+lazpavel@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:44:42 -0400 Subject: [PATCH 3/6] chore(graphql-model-transformer): fixed merge conflicts --- .../model-transformer.test.ts.snap | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap index 8c37f331e15..86fdbd59820 100644 --- a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap +++ b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap @@ -15,7 +15,7 @@ type Email { updatedAt: AWSDateTime! } -input ModelStringInput { +input ModelStringFilterInput { ne: String eq: String le: String @@ -31,7 +31,7 @@ input ModelStringInput { size: ModelSizeInput } -input ModelIntInput { +input ModelIntFilterInput { ne: Int eq: Int le: Int @@ -43,7 +43,7 @@ input ModelIntInput { attributeType: ModelAttributeTypes } -input ModelFloatInput { +input ModelFloatFilterInput { ne: Float eq: Float le: Float @@ -55,14 +55,14 @@ input ModelFloatInput { attributeType: ModelAttributeTypes } -input ModelBooleanInput { +input ModelBooleanFilterInput { ne: Boolean eq: Boolean attributeExists: Boolean attributeType: ModelAttributeTypes } -input ModelIDInput { +input ModelIDFilterInput { ne: ID eq: ID le: ID @@ -114,14 +114,14 @@ type ModelTestConnection { } input ModelTestFilterInput { - id: ModelIDInput + id: ModelIDFilterInput and: [ModelTestFilterInput] or: [ModelTestFilterInput] not: ModelTestFilterInput } input ModelTestConditionInput { - id: ModelIDInput + id: ModelIDFilterInput and: [ModelTestConditionInput] or: [ModelTestConditionInput] not: ModelTestConditionInput @@ -163,14 +163,14 @@ type ModelEmailConnection { } input ModelEmailFilterInput { - id: ModelIDInput + id: ModelIDFilterInput and: [ModelEmailFilterInput] or: [ModelEmailFilterInput] not: ModelEmailFilterInput } input ModelEmailConditionInput { - id: ModelIDInput + id: ModelIDFilterInput and: [ModelEmailConditionInput] or: [ModelEmailConditionInput] not: ModelEmailConditionInput From 3fd723ee2c431cac5fef21ee66687476b65f6135 Mon Sep 17 00:00:00 2001 From: lazpavel <85319655+lazpavel@users.noreply.github.com> Date: Tue, 10 Aug 2021 16:23:06 -0400 Subject: [PATCH 4/6] fix(graphql-model-transformer): fixed update and create input field type known model types filtering --- .../model-transformer.test.ts.snap | 327 ++++-------------- .../src/__tests__/model-transformer.test.ts | 32 +- .../src/graphql-types/mutation.ts | 8 +- 3 files changed, 103 insertions(+), 264 deletions(-) diff --git a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap index 5e0048c7be3..a047e7073fb 100644 --- a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap +++ b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap @@ -1,10 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ModelTransformer: should have timestamps as nullable fields when the type makes it non-nullable 1`] = ` +exports[`ModelTransformer: should filter known input types from create and update input fields 1`] = ` " -type Post { +type Test { + id: ID! + email: Email + createdAt: AWSDateTime! + updatedAt: AWSDateTime! +} + +type Email { id: ID! - str: String createdAt: AWSDateTime! updatedAt: AWSDateTime! } @@ -95,291 +101,94 @@ input ModelSizeInput { between: [Int] } -enum ModelSortDirection { - ASC - DESC -} - type Query { - getPost(id: ID!): Post - listPosts(filter: ModelPostFilterInput, limit: Int, nextToken: String): ModelPostConnection + getTest(id: ID!): Test + listTests(filter: ModelTestFilterInput, limit: Int, nextToken: String): ModelTestConnection + getEmail(id: ID!): Email + listEmails(filter: ModelEmailFilterInput, limit: Int, nextToken: String): ModelEmailConnection } -type ModelPostConnection { - items: [Post] +type ModelTestConnection { + items: [Test] nextToken: String } -input ModelPostFilterInput { +input ModelTestFilterInput { id: ModelIDInput - str: ModelStringInput - createdAt: ModelStringInput - updatedAt: ModelStringInput - and: [ModelPostFilterInput] - or: [ModelPostFilterInput] - not: ModelPostFilterInput + and: [ModelTestFilterInput] + or: [ModelTestFilterInput] + not: ModelTestFilterInput } -input ModelPostConditionInput { +input ModelTestConditionInput { id: ModelIDInput - str: ModelStringInput - createdAt: ModelStringInput - updatedAt: ModelStringInput - and: [ModelPostConditionInput] - or: [ModelPostConditionInput] - not: ModelPostConditionInput + and: [ModelTestConditionInput] + or: [ModelTestConditionInput] + not: ModelTestConditionInput } -input CreatePostInput { +input CreateTestInput { id: ID - str: String - createdAt: AWSDateTime - updatedAt: AWSDateTime } type Mutation { - createPost(input: CreatePostInput!, condition: ModelPostConditionInput): Post - updatePost(input: UpdatePostInput!, condition: ModelPostConditionInput): Post - deletePost(input: DeletePostInput!, condition: ModelPostConditionInput): Post + createTest(input: CreateTestInput!, condition: ModelTestConditionInput): Test + updateTest(input: UpdateTestInput!, condition: ModelTestConditionInput): Test + deleteTest(input: DeleteTestInput!, condition: ModelTestConditionInput): Test + createEmail(input: CreateEmailInput!, condition: ModelEmailConditionInput): Email + updateEmail(input: UpdateEmailInput!, condition: ModelEmailConditionInput): Email + deleteEmail(input: DeleteEmailInput!, condition: ModelEmailConditionInput): Email } -input UpdatePostInput { +input UpdateTestInput { id: ID! - str: String - createdAt: AWSDateTime - updatedAt: AWSDateTime } -input DeletePostInput { +input DeleteTestInput { id: ID! } type Subscription { - onCreatePost: Post @aws_subscribe(mutations: [\\"createPost\\"]) - onUpdatePost: Post @aws_subscribe(mutations: [\\"updatePost\\"]) - onDeletePost: Post @aws_subscribe(mutations: [\\"deletePost\\"]) + onCreateTest: Test @aws_subscribe(mutations: [\\"createTest\\"]) + onUpdateTest: Test @aws_subscribe(mutations: [\\"updateTest\\"]) + onDeleteTest: Test @aws_subscribe(mutations: [\\"deleteTest\\"]) + onCreateEmail: Email @aws_subscribe(mutations: [\\"createEmail\\"]) + onUpdateEmail: Email @aws_subscribe(mutations: [\\"updateEmail\\"]) + onDeleteEmail: Email @aws_subscribe(mutations: [\\"deleteEmail\\"]) } -" -`; +type ModelEmailConnection { + items: [Email] + nextToken: String +} -exports[`ModelTransformer: should have timestamps as nullable fields when the type makes it non-nullable 2`] = ` -"## [Start] Create Request template. ** -## Begin - key condition ** -#if( $ctx.stash.metadata.modelObjectKey ) - #set( $keyConditionExpr = {} ) - #set( $keyConditionExprNames = {} ) - #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) - $util.qr($keyConditionExpr.put(\\"keyCondition$velocityCount\\", { - \\"attributeExists\\": false -})) - $util.qr($keyConditionExprNames.put(\\"#keyCondition$velocityCount\\", \\"$entry.key\\")) - #end - $util.qr($ctx.stash.conditions.add($keyConditionExpr)) -#else - $util.qr($ctx.stash.conditions.add({ - \\"id\\": { - \\"attributeExists\\": false - } -})) -#end -## End - key condition ** -## Set the default values to put request ** -#set( $mergedValues = $util.defaultIfNull($ctx.stash.defaultValues, {}) ) -## copy the values from input ** -$util.qr($mergedValues.putAll($util.defaultIfNull($ctx.args.input, {}))) -## set the typename ** -$util.qr($mergedValues.put(\\"__typename\\", \\"Post\\")) -#set( $PutObject = { - \\"version\\": \\"2018-05-29\\", - \\"operation\\": \\"PutItem\\", - \\"attributeValues\\": $util.dynamodb.toMapValues($mergedValues), - \\"condition\\": $condition -} ) -#if( $context.args.condition ) - $util.qr($ctx.stash.conditions.add($context.args.condition)) -#end -## Begin - key condition ** -#if( $ctx.stash.metadata.modelObjectKey ) - #set( $keyConditionExpr = {} ) - #set( $keyConditionExprNames = {} ) - #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) - $util.qr($keyConditionExpr.put(\\"keyCondition$velocityCount\\", { - \\"attributeExists\\": false -})) - $util.qr($keyConditionExprNames.put(\\"#keyCondition$velocityCount\\", \\"$entry.key\\")) - #end - $util.qr($ctx.stash.conditions.add($keyConditionExpr)) -#else - $util.qr($ctx.stash.conditions.add({ - \\"id\\": { - \\"attributeExists\\": false - } -})) -#end -## End - key condition ** -## Start condition block ** -#if( $ctx.stash.conditions && $ctx.stash.conditions.size() != 0 ) - #set( $mergedConditions = { - \\"and\\": $ctx.stash.conditions -} ) - #set( $Conditions = $util.parseJson($util.transform.toDynamoDBConditionExpression($mergedConditions)) ) - #if( $Conditions.expressionValues && $Conditions.expressionValues.size() == 0 ) - #set( $Conditions = { - \\"expression\\": $Conditions.expression, - \\"expressionNames\\": $Conditions.expressionNames -} ) - #end - ## End condition block ** -#end -#if( $Conditions ) - #if( $keyConditionExprNames ) - $util.qr($Conditions.expressionNames.putAll($keyConditionExprNames)) - #end - $util.qr($PutObject.put(\\"condition\\", $Conditions)) -#end -#if( $ctx.stash.metadata.modelObjectKey ) - $util.qr($PutObject.put(\\"key\\", $ctx.stash.metadata.modelObjectKey)) -#else - #set( $Key = { - \\"id\\": $util.dynamodb.toDynamoDB($mergedValues.id) -} ) - $util.qr($PutObject.put(\\"key\\", $Key)) -#end -$util.toJson($PutObject) -## [End] Create Request template. **" -`; +input ModelEmailFilterInput { + id: ModelIDInput + and: [ModelEmailFilterInput] + or: [ModelEmailFilterInput] + not: ModelEmailFilterInput +} -exports[`ModelTransformer: should have timestamps as nullable fields when the type makes it non-nullable 3`] = ` -"## [Start] Mutation Update resolver. ** -## Set the default values to put request ** -#set( $mergedValues = $util.defaultIfNull($ctx.stash.defaultValues, {}) ) -## copy the values from input ** -$util.qr($mergedValues.putAll($util.defaultIfNull($ctx.args.input, {}))) -## set the typename ** -## Initialize the vars for creating ddb expression ** -#set( $expNames = {} ) -#set( $expValues = {} ) -#set( $expSet = {} ) -#set( $expAdd = {} ) -#set( $expRemove = [] ) -#if( $ctx.stash.metadata.modelObjectKey ) - #set( $Key = $ctx.stash.metadata.modelObjectKey ) -#else - #set( $Key = { - \\"id\\": $util.dynamodb.toDynamoDB($ctx.args.input.id) -} ) -#end -## Model key ** -#if( $ctx.stash.metadata.modelObjectKey ) - #set( $keyFields = [] ) - #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) - $util.qr($keyFields.add(\\"$entry.key\\")) - #end -#else - #set( $keyFields = [\\"id\\"] ) -#end -#foreach( $entry in $util.map.copyAndRemoveAllKeys($mergedValues, $keyFields).entrySet() ) - #if( !$util.isNull($ctx.stash.metadata.dynamodbNameOverrideMap) && $ctx.stash.metadata.dynamodbNameOverrideMap.containsKey(\\"$entry.key\\") ) - #set( $entryKeyAttributeName = $ctx.stash.metadata.dynamodbNameOverrideMap.get(\\"$entry.key\\") ) - #else - #set( $entryKeyAttributeName = $entry.key ) - #end - #if( $util.isNull($entry.value) ) - #set( $discard = $expRemove.add(\\"#$entryKeyAttributeName\\") ) - $util.qr($expNames.put(\\"#$entryKeyAttributeName\\", \\"$entry.key\\")) - #else - $util.qr($expSet.put(\\"#$entryKeyAttributeName\\", \\":$entryKeyAttributeName\\")) - $util.qr($expNames.put(\\"#$entryKeyAttributeName\\", \\"$entry.key\\")) - $util.qr($expValues.put(\\":$entryKeyAttributeName\\", $util.dynamodb.toDynamoDB($entry.value))) - #end -#end -#set( $expression = \\"\\" ) -#if( !$expSet.isEmpty() ) - #set( $expression = \\"SET\\" ) - #foreach( $entry in $expSet.entrySet() ) - #set( $expression = \\"$expression $entry.key = $entry.value\\" ) - #if( $foreach.hasNext() ) - #set( $expression = \\"$expression,\\" ) - #end - #end -#end -#if( !$expAdd.isEmpty() ) - #set( $expression = \\"$expression ADD\\" ) - #foreach( $entry in $expAdd.entrySet() ) - #set( $expression = \\"$expression $entry.key $entry.value\\" ) - #if( $foreach.hasNext() ) - #set( $expression = \\"$expression,\\" ) - #end - #end -#end -#if( !$expRemove.isEmpty() ) - #set( $expression = \\"$expression REMOVE\\" ) - #foreach( $entry in $expRemove ) - #set( $expression = \\"$expression $entry\\" ) - #if( $foreach.hasNext() ) - #set( $expression = \\"$expression,\\" ) - #end - #end -#end -#set( $update = {} ) -$util.qr($update.put(\\"expression\\", \\"$expression\\")) -#if( !$expNames.isEmpty() ) - $util.qr($update.put(\\"expressionNames\\", $expNames)) -#end -#if( !$expValues.isEmpty() ) - $util.qr($update.put(\\"expressionValues\\", $expValues)) -#end -## Begin - key condition ** -#if( $ctx.stash.metadata.modelObjectKey ) - #set( $keyConditionExpr = {} ) - #set( $keyConditionExprNames = {} ) - #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) - $util.qr($keyConditionExpr.put(\\"keyCondition$velocityCount\\", { - \\"attributeExists\\": true -})) - $util.qr($keyConditionExprNames.put(\\"#keyCondition$velocityCount\\", \\"$entry.key\\")) - #end - $util.qr($ctx.stash.conditions.add($keyConditionExpr)) -#else - $util.qr($ctx.stash.conditions.add({ - \\"id\\": { - \\"attributeExists\\": true - } -})) -#end -## End - key condition ** -#if( $context.args.condition ) - $util.qr($ctx.stash.conditions.add($context.args.condition)) -#end -## Start condition block ** -#if( $ctx.stash.conditions && $ctx.stash.conditions.size() != 0 ) - #set( $mergedConditions = { - \\"and\\": $ctx.stash.conditions -} ) - #set( $Conditions = $util.parseJson($util.transform.toDynamoDBConditionExpression($mergedConditions)) ) - #if( $Conditions.expressionValues && $Conditions.expressionValues.size() == 0 ) - #set( $Conditions = { - \\"expression\\": $Conditions.expression, - \\"expressionNames\\": $Conditions.expressionNames -} ) - #end - ## End condition block ** -#end -#set( $UpdateItem = { - \\"version\\": \\"2018-05-29\\", - \\"operation\\": \\"UpdateItem\\", - \\"key\\": $Key, - \\"update\\": $update -} ) -#if( $Conditions ) - #if( $keyConditionExprNames ) - $util.qr($Conditions.expressionNames.putAll($keyConditionExprNames)) - #end - $util.qr($UpdateItem.put(\\"condition\\", $Conditions)) -#end -$util.toJson($UpdateItem) -## [End] Mutation Update resolver. **" +input ModelEmailConditionInput { + id: ModelIDInput + and: [ModelEmailConditionInput] + or: [ModelEmailConditionInput] + not: ModelEmailConditionInput +} + +input CreateEmailInput { + id: ID +} + +input UpdateEmailInput { + id: ID! +} + +input DeleteEmailInput { + id: ID! +} + +" `; exports[`ModelTransformer: should not add default primary key when ID is defined 1`] = ` diff --git a/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts b/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts index c195d10498f..c4807c63cc8 100644 --- a/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts +++ b/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts @@ -518,7 +518,7 @@ describe('ModelTransformer: ', () => { const createTestInput = getInputType(parsed, 'CreateTestInput'); expectFieldsOnInputType(createTestInput!, ['status', 'lastStatus']); - const updateTestInput = getInputType(parsed, 'CreateTestInput'); + const updateTestInput = getInputType(parsed, 'UpdateTestInput'); expectFieldsOnInputType(updateTestInput!, ['status', 'lastStatus']); }); @@ -629,6 +629,7 @@ describe('ModelTransformer: ', () => { transformers: [new ModelTransformer()], featureFlags, }); + const out = transformer.transform(validSchema); expect(out).toBeDefined(); const definition = out.schema; @@ -648,6 +649,35 @@ describe('ModelTransformer: ', () => { expect(mutList).toContain('createPost'); expect(mutList).toContain('updatePost'); expect(mutList).toContain('deletePost'); + + it('should filter known input types from create and update input fields', () => { + const validSchema = ` + type Test @model { + id: ID! + email: Email + } + + type Email @model { + id: ID! + } + `; + const transformer = new GraphQLTransform({ + transformers: [new ModelTransformer()], + featureFlags, + }); + + const result = transformer.transform(validSchema); + expect(result).toBeDefined(); + expect(result.schema).toBeDefined(); + expect(result.schema).toMatchSnapshot(); + const schema = parse(result.schema); + validateModelSchema(schema); + + const createTestInput = getInputType(schema, 'CreateTestInput'); + expect(getFieldOnInputType(createTestInput!, 'email')).toBeUndefined(); + + const updateTestInput = getInputType(schema, 'UpdateTestInput'); + expect(getFieldOnInputType(updateTestInput!, 'email')).toBeUndefined(); }); it('should not generate superfluous input and filter types', () => { diff --git a/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts b/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts index 4e9a5828fa2..77287c0b448 100644 --- a/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts +++ b/packages/amplify-graphql-model-transformer/src/graphql-types/mutation.ts @@ -1,8 +1,8 @@ import { TransformerTransformSchemaStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces'; -import { ObjectTypeDefinitionNode, InputObjectTypeDefinitionNode, DocumentNode } from 'graphql'; +import { DocumentNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode } from 'graphql'; import { ModelResourceIDs, toPascalCase } from 'graphql-transformer-common'; import { ModelDirectiveConfiguration } from '../graphql-model-transformer'; -import { ObjectDefinitionWrapper, InputObjectDefinitionWrapper, InputFieldWrapper } from '../wrappers/object-definition-wrapper'; +import { InputFieldWrapper, InputObjectDefinitionWrapper, ObjectDefinitionWrapper } from '../wrappers/object-definition-wrapper'; import { makeConditionFilterInput } from './common'; /** @@ -30,7 +30,7 @@ export const makeUpdateInputField = ( return false; }) .map(field => { - return field.getTypeName(); + return field.name; }); const objectTypeDefinition: ObjectTypeDefinitionNode = { @@ -103,7 +103,7 @@ export const makeCreateInputField = ( return false; }) .map(field => { - return field.getTypeName(); + return field.name; }); const objectTypeDefinition: ObjectTypeDefinitionNode = { From bada50b82ab645e282ba58d66504563a328bfc8e Mon Sep 17 00:00:00 2001 From: lazpavel <85319655+lazpavel@users.noreply.github.com> Date: Tue, 10 Aug 2021 16:23:06 -0400 Subject: [PATCH 5/6] fix(graphql-model-transformer): fixed update and create input field type known model types filtering --- .../src/__tests__/model-transformer.test.ts | 241 ------------------ 1 file changed, 241 deletions(-) diff --git a/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts b/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts index c4807c63cc8..b8c90a68d5c 100644 --- a/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts +++ b/packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts @@ -522,134 +522,6 @@ describe('ModelTransformer: ', () => { expectFieldsOnInputType(updateTestInput!, ['status', 'lastStatus']); }); - it('should support non-model types and enums', () => { - const validSchema = ` - type Post @model { - id: ID! - title: String! - createdAt: String - updatedAt: String - metadata: [PostMetadata!]! - appearsIn: [Episode]! - } - type PostMetadata { - tags: Tag - } - type Tag { - published: Boolean - metadata: PostMetadata - } - enum Episode { - NEWHOPE - EMPIRE - JEDI - } - `; - const transformer = new GraphQLTransform({ - transformers: [new ModelTransformer()], - featureFlags, - }); - const out = transformer.transform(validSchema); - expect(out).toBeDefined(); - - const definition = out.schema; - expect(definition).toBeDefined(); - const parsed = parse(definition); - validateModelSchema(parsed); - - const postMetaDataInputType = getInputType(parsed, 'PostMetadataInput'); - expect(postMetaDataInputType).toBeDefined(); - const tagInputType = getInputType(parsed, 'TagInput'); - expect(tagInputType).toBeDefined(); - expectFieldsOnInputType(tagInputType!, ['metadata']); - const createPostInputType = getInputType(parsed, 'CreatePostInput'); - expectFieldsOnInputType(createPostInputType!, ['metadata', 'appearsIn']); - const updatePostInputType = getInputType(parsed, 'UpdatePostInput'); - expectFieldsOnInputType(updatePostInputType!, ['metadata', 'appearsIn']); - - const postModelObject = getObjectType(parsed, 'Post'); - const postMetaDataInputField = getFieldOnInputType(createPostInputType!, 'metadata'); - const postMetaDataField = getFieldOnObjectType(postModelObject!, 'metadata'); - // this checks that the non-model type was properly "unwrapped", renamed, and "rewrapped" - // in the generated CreatePostInput type - its types should be the same as in the Post @model type - verifyMatchingTypes(postMetaDataInputField.type, postMetaDataField.type); - - expect(verifyInputCount(parsed, 'PostMetadataInput', 1)).toBeTruthy(); - expect(verifyInputCount(parsed, 'TagInput', 1)).toBeTruthy(); - }); - - it('it should generate filter inputs', () => { - const validSchema = ` - type Post @model { - id: ID! - title: String! - createdAt: String - updatedAt: String - }`; - const transformer = new GraphQLTransform({ - transformers: [new ModelTransformer()], - featureFlags, - }); - const out = transformer.transform(validSchema); - expect(out).toBeDefined(); - - const definition = out.schema; - expect(definition).toBeDefined(); - const parsed = parse(definition); - validateModelSchema(parsed); - - const queryType = getObjectType(parsed, 'Query'); - expect(queryType).toBeDefined(); - expectFields(queryType!, ['listPosts']); - - const connectionType = getObjectType(parsed, 'ModelPostConnection'); - expect(connectionType).toBeDefined(); - - expect(verifyInputCount(parsed, 'ModelStringInput', 1)).toBeTruthy(); - expect(verifyInputCount(parsed, 'ModelBooleanInput', 1)).toBeTruthy(); - expect(verifyInputCount(parsed, 'ModelIntInput', 1)).toBeTruthy(); - expect(verifyInputCount(parsed, 'ModelFloatInput', 1)).toBeTruthy(); - expect(verifyInputCount(parsed, 'ModelIDInput', 1)).toBeTruthy(); - expect(verifyInputCount(parsed, 'ModelPostFilterInput', 1)).toBeTruthy(); - }); - - it('should support advanced subscriptions', () => { - const validSchema = `type Post @model(subscriptions: { - onCreate: ["onFeedUpdated", "onCreatePost"], - onUpdate: ["onFeedUpdated"], - onDelete: ["onFeedUpdated"] - }) { - id: ID! - title: String! - createdAt: String - updatedAt: String - } - `; - const transformer = new GraphQLTransform({ - transformers: [new ModelTransformer()], - featureFlags, - }); - - const out = transformer.transform(validSchema); - expect(out).toBeDefined(); - const definition = out.schema; - expect(definition).toBeDefined(); - const parsed = parse(definition); - validateModelSchema(parsed); - - const subscriptionType = getObjectType(parsed, 'Subscription'); - expect(subscriptionType).toBeDefined(); - expectFields(subscriptionType!, ['onFeedUpdated', 'onCreatePost']); - const subField = subscriptionType!.fields!.find(f => f.name.value === 'onFeedUpdated'); - expect(subField!.directives!.length).toEqual(1); - expect(subField!.directives![0].name!.value).toEqual('aws_subscribe'); - const mutationsList = subField!.directives![0].arguments!.find(a => a.name.value === 'mutations')!.value as ListValueNode; - const mutList = mutationsList.values.map((v: any) => v.value); - expect(mutList.length).toEqual(3); - expect(mutList).toContain('createPost'); - expect(mutList).toContain('updatePost'); - expect(mutList).toContain('deletePost'); - it('should filter known input types from create and update input fields', () => { const validSchema = ` type Test @model { @@ -665,7 +537,6 @@ describe('ModelTransformer: ', () => { transformers: [new ModelTransformer()], featureFlags, }); - const result = transformer.transform(validSchema); expect(result).toBeDefined(); expect(result.schema).toBeDefined(); @@ -679,116 +550,4 @@ describe('ModelTransformer: ', () => { const updateTestInput = getInputType(schema, 'UpdateTestInput'); expect(getFieldOnInputType(updateTestInput!, 'email')).toBeUndefined(); }); - - it('should not generate superfluous input and filter types', () => { - const validSchema = ` - type Entity @model(mutations: null, subscriptions: null, queries: {get: "getEntity"}) { - id: ID! - str: String - } - `; - const transformer = new GraphQLTransform({ - transformers: [new ModelTransformer()], - featureFlags, - }); - const result = transformer.transform(validSchema); - expect(result).toBeDefined(); - expect(result.schema).toBeDefined(); - expect(result.schema).toMatchSnapshot(); - const schema = parse(result.schema); - validateModelSchema(schema); - }); - - it('should support timestamp parameters when generating pipelineFunctions and output schema', () => { - const validSchema = ` - type Post @model(timestamps: { createdAt: "createdOn", updatedAt: "updatedOn"}) { - id: ID! - str: String - } - `; - const transformer = new GraphQLTransform({ - transformers: [new ModelTransformer()], - featureFlags, - }); - const result = transformer.transform(validSchema); - expect(result).toBeDefined(); - expect(result.schema).toBeDefined(); - expect(result.schema).toMatchSnapshot(); - const schema = parse(result.schema); - validateModelSchema(schema); - - expect(result.pipelineFunctions['Mutation.createPost.req.vtl']).toMatchSnapshot(); - expect(result.pipelineFunctions['Mutation.updatePost.req.vtl']).toMatchSnapshot(); - }); - - it('should not to auto generate createdAt and updatedAt when the type in schema is not AWSDateTime', () => { - const validSchema = ` - type Post @model { - id: ID! - str: String - createdAt: AWSTimestamp - updatedAt: AWSTimestamp - } - `; - const transformer = new GraphQLTransform({ - transformers: [new ModelTransformer()], - featureFlags, - }); - const result = transformer.transform(validSchema); - expect(result).toBeDefined(); - expect(result.schema).toBeDefined(); - expect(result.schema).toMatchSnapshot(); - const schema = parse(result.schema); - validateModelSchema(schema); - - expect(result.pipelineFunctions['Mutation.createPost.req.vtl']).toMatchSnapshot(); - expect(result.pipelineFunctions['Mutation.updatePost.req.vtl']).toMatchSnapshot(); - }); - - it('should have timestamps as nullable fields when the type makes it non-nullable', () => { - const validSchema = ` - type Post @model { - id: ID! - str: String - createdAt: AWSDateTime! - updatedAt: AWSDateTime! - } - `; - const transformer = new GraphQLTransform({ - transformers: [new ModelTransformer()], - featureFlags, - }); - - const result = transformer.transform(validSchema); - expect(result).toBeDefined(); - expect(result.schema).toBeDefined(); - expect(result.schema).toMatchSnapshot(); - const schema = parse(result.schema); - validateModelSchema(schema); - - expect(result.pipelineFunctions['Mutation.createPost.req.vtl']).toMatchSnapshot(); - expect(result.pipelineFunctions['Mutation.updatePost.req.vtl']).toMatchSnapshot(); - }); - - it('should not to include createdAt and updatedAt field when timestamps is set to null', () => { - const validSchema = ` - type Post @model(timestamps: null) { - id: ID! - str: String - } - `; - const transformer = new GraphQLTransform({ - transformers: [new ModelTransformer()], - featureFlags, - }); - const result = transformer.transform(validSchema); - expect(result).toBeDefined(); - expect(result.schema).toBeDefined(); - expect(result.schema).toMatchSnapshot(); - const schema = parse(result.schema); - validateModelSchema(schema); - - expect(result.pipelineFunctions['Mutation.createPost.req.vtl']).toMatchSnapshot(); - expect(result.pipelineFunctions['Mutation.updatePost.req.vtl']).toMatchSnapshot(); - }); }); From 038df1e5e1ce9660b22dfcfdb23a0cdb0bccbce5 Mon Sep 17 00:00:00 2001 From: lazpavel <85319655+lazpavel@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:44:42 -0400 Subject: [PATCH 6/6] chore(graphql-model-transformer): fixed merge conflicts --- .../model-transformer.test.ts.snap | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap index a047e7073fb..93998418ff0 100644 --- a/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap +++ b/packages/amplify-graphql-model-transformer/src/__tests__/__snapshots__/model-transformer.test.ts.snap @@ -15,7 +15,7 @@ type Email { updatedAt: AWSDateTime! } -input ModelStringInput { +input ModelStringFilterInput { ne: String eq: String le: String @@ -31,7 +31,7 @@ input ModelStringInput { size: ModelSizeInput } -input ModelIntInput { +input ModelIntFilterInput { ne: Int eq: Int le: Int @@ -43,7 +43,7 @@ input ModelIntInput { attributeType: ModelAttributeTypes } -input ModelFloatInput { +input ModelFloatFilterInput { ne: Float eq: Float le: Float @@ -55,14 +55,14 @@ input ModelFloatInput { attributeType: ModelAttributeTypes } -input ModelBooleanInput { +input ModelBooleanFilterInput { ne: Boolean eq: Boolean attributeExists: Boolean attributeType: ModelAttributeTypes } -input ModelIDInput { +input ModelIDFilterInput { ne: ID eq: ID le: ID @@ -114,14 +114,14 @@ type ModelTestConnection { } input ModelTestFilterInput { - id: ModelIDInput + id: ModelIDFilterInput and: [ModelTestFilterInput] or: [ModelTestFilterInput] not: ModelTestFilterInput } input ModelTestConditionInput { - id: ModelIDInput + id: ModelIDFilterInput and: [ModelTestConditionInput] or: [ModelTestConditionInput] not: ModelTestConditionInput @@ -163,14 +163,14 @@ type ModelEmailConnection { } input ModelEmailFilterInput { - id: ModelIDInput + id: ModelIDFilterInput and: [ModelEmailFilterInput] or: [ModelEmailFilterInput] not: ModelEmailFilterInput } input ModelEmailConditionInput { - id: ModelIDInput + id: ModelIDFilterInput and: [ModelEmailConditionInput] or: [ModelEmailConditionInput] not: ModelEmailConditionInput