diff --git a/packages/amplify-graphql-predictions-transformer/src/__tests__/amplify-graphql-predictions-transformer.test.ts b/packages/amplify-graphql-predictions-transformer/src/__tests__/amplify-graphql-predictions-transformer.test.ts index 0913a57803f..1147d68ec4e 100644 --- a/packages/amplify-graphql-predictions-transformer/src/__tests__/amplify-graphql-predictions-transformer.test.ts +++ b/packages/amplify-graphql-predictions-transformer/src/__tests__/amplify-graphql-predictions-transformer.test.ts @@ -1,6 +1,6 @@ 'use strict'; import { anything, countResources, expect as cdkExpect, haveResourceLike } from '@aws-cdk/assert'; -import { GraphQLTransform } from '@aws-amplify/graphql-transformer-core'; +import { GraphQLTransform, validateModelSchema } from '@aws-amplify/graphql-transformer-core'; import { parse } from 'graphql'; import { PredictionsTransformer } from '..'; @@ -14,6 +14,7 @@ test('does not generate any resources if @predictions is unused', () => { }); const out = transformer.transform(schema); + validateModelSchema(parse(out.schema)); expect(out).toBeDefined(); expect(out.stacks).toBeDefined(); expect(out.stacks.PredictionsDirectiveStack).toEqual(undefined); @@ -31,7 +32,7 @@ test('lambda function is added to pipeline when lambda dependent action is added const out = transformer.transform(validSchema); expect(out).toBeDefined(); expect(out.stacks).toBeDefined(); - parse(out.schema); + validateModelSchema(parse(out.schema)); expect(out.schema).toMatchSnapshot(); const stack = out.stacks.PredictionsDirectiveStack; expect(stack).toBeDefined(); @@ -157,7 +158,7 @@ test('return type is a list based on the action', () => { const out = transformer.transform(validSchema); expect(out).toBeDefined(); expect(out.stacks).toBeDefined(); - parse(out.schema); + validateModelSchema(parse(out.schema)); expect(out.schema).toMatchSnapshot(); const stack = out.stacks.PredictionsDirectiveStack; expect(stack).toBeDefined(); @@ -186,7 +187,7 @@ test('can use actions individually and in supported sequences', () => { const out = transformer.transform(validSchema); expect(out).toBeDefined(); expect(out.stacks).toBeDefined(); - parse(out.schema); + validateModelSchema(parse(out.schema)); expect(out.schema).toMatchSnapshot(); const stack = out.stacks.PredictionsDirectiveStack; expect(stack).toBeDefined(); diff --git a/packages/amplify-graphql-transformer-core/src/index.ts b/packages/amplify-graphql-transformer-core/src/index.ts index e3488cb0be9..d3f991998b2 100644 --- a/packages/amplify-graphql-transformer-core/src/index.ts +++ b/packages/amplify-graphql-transformer-core/src/index.ts @@ -14,6 +14,7 @@ export { UserPoolConfig, } from './transformation'; export { DeploymentResources } from './transformation/types'; +export { validateModelSchema } from './transformation/validation'; export { ConflictDetectionType, ConflictHandlerType,