From f3c77e35237abb980e50ab300fb39eb72a1f3934 Mon Sep 17 00:00:00 2001 From: Bryan Pan Date: Mon, 31 Aug 2020 14:56:35 -0700 Subject: [PATCH] refactor(appsync): graphQLApi to graphqlApi for better snakecasing --- .../@aws-cdk/aws-appsync/lib/graphqlapi.ts | 14 +++--- packages/@aws-cdk/aws-appsync/lib/schema.ts | 4 +- packages/@aws-cdk/aws-appsync/package.json | 3 +- .../aws-appsync/test/appsync-auth.test.ts | 46 +++++++++---------- .../test/appsync-code-first.test.ts | 16 +++---- .../aws-appsync/test/appsync-dynamodb.test.ts | 10 ++-- .../aws-appsync/test/appsync-grant.test.ts | 4 +- .../aws-appsync/test/appsync-http.test.ts | 10 ++-- .../test/appsync-interface-type.test.ts | 4 +- .../aws-appsync/test/appsync-lambda.test.ts | 10 ++-- .../aws-appsync/test/appsync-none.test.ts | 10 ++-- .../test/appsync-object-type.test.ts | 4 +- .../test/appsync-scalar-type.test.ts | 4 +- .../aws-appsync/test/appsync-schema.test.ts | 24 +++++----- .../@aws-cdk/aws-appsync/test/appsync.test.ts | 6 +-- .../aws-appsync/test/integ.api-import.ts | 8 ++-- .../aws-appsync/test/integ.graphql-iam.ts | 8 ++-- .../aws-appsync/test/integ.graphql-schema.ts | 2 +- .../aws-appsync/test/integ.graphql.ts | 4 +- 19 files changed, 95 insertions(+), 96 deletions(-) diff --git a/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts b/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts index 4251336f017ea..052e3ecd53392 100644 --- a/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts +++ b/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts @@ -206,7 +206,7 @@ export interface LogConfig { /** * Properties for an AppSync GraphQL API */ -export interface GraphQLApiProps { +export interface GraphqlApiProps { /** * the name of the GraphQL API */ @@ -293,7 +293,7 @@ export class IamResource { * * @param api The GraphQL API to give permissions */ - public resourceArns(api: GraphQLApi): string[] { + public resourceArns(api: GraphqlApi): string[] { return this.arns.map((arn) => Stack.of(api).formatArn({ service: 'appsync', resource: `apis/${api.apiId}`, @@ -325,7 +325,7 @@ export interface GraphqlApiAttributes { * * @resource AWS::AppSync::GraphQLApi */ -export class GraphQLApi extends GraphqlApiBase { +export class GraphqlApi extends GraphqlApiBase { /** * Import a GraphQL API through this function * @@ -362,9 +362,9 @@ export class GraphQLApi extends GraphqlApiBase { /** * the URL of the endpoint created by AppSync * - * @attribute + * @attribute GraphQlUrl */ - public readonly graphQlUrl: string; + public readonly graphqlUrl: string; /** * the name of the API @@ -387,7 +387,7 @@ export class GraphQLApi extends GraphqlApiBase { private api: CfnGraphQLApi; private apiKeyResource?: CfnApiKey; - constructor(scope: Construct, id: string, props: GraphQLApiProps) { + constructor(scope: Construct, id: string, props: GraphqlApiProps) { super(scope, id); const defaultMode = props.authorizationConfig?.defaultAuthorization ?? @@ -409,7 +409,7 @@ export class GraphQLApi extends GraphqlApiBase { this.apiId = this.api.attrApiId; this.arn = this.api.attrArn; - this.graphQlUrl = this.api.attrGraphQlUrl; + this.graphqlUrl = this.api.attrGraphQlUrl; this.name = this.api.name; this.schema = props.schema ?? new Schema(); this.schemaResource = this.schema.bind(this); diff --git a/packages/@aws-cdk/aws-appsync/lib/schema.ts b/packages/@aws-cdk/aws-appsync/lib/schema.ts index f7751f38a3182..0efb28074fc27 100644 --- a/packages/@aws-cdk/aws-appsync/lib/schema.ts +++ b/packages/@aws-cdk/aws-appsync/lib/schema.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'fs'; import { Lazy } from '@aws-cdk/core'; import { CfnGraphQLSchema } from './appsync.generated'; -import { GraphQLApi } from './graphqlapi'; +import { GraphqlApi } from './graphqlapi'; import { SchemaMode, shapeAddition } from './private'; import { IIntermediateType } from './schema-base'; import { ResolvableField } from './schema-field'; @@ -72,7 +72,7 @@ export class Schema { * * @param api The binding GraphQL Api */ - public bind(api: GraphQLApi): CfnGraphQLSchema { + public bind(api: GraphqlApi): CfnGraphQLSchema { if (!this.schema) { this.schema = new CfnGraphQLSchema(api, 'Schema', { apiId: api.apiId, diff --git a/packages/@aws-cdk/aws-appsync/package.json b/packages/@aws-cdk/aws-appsync/package.json index 7c38409b37325..6726dc41c43a4 100644 --- a/packages/@aws-cdk/aws-appsync/package.json +++ b/packages/@aws-cdk/aws-appsync/package.json @@ -98,8 +98,7 @@ "no-unused-type:@aws-cdk/aws-appsync.ApiKeyConfig", "no-unused-type:@aws-cdk/aws-appsync.UserPoolConfig", "no-unused-type:@aws-cdk/aws-appsync.UserPoolDefaultAction", - "props-physical-name:@aws-cdk/aws-appsync.GraphQLApiProps", - "from-method:@aws-cdk/aws-appsync.GraphQLApi" + "props-physical-name:@aws-cdk/aws-appsync.GraphqlApiProps" ] }, "stability": "experimental", diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts index fabde1d59c95e..5815908198feb 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts @@ -13,7 +13,7 @@ beforeEach(() => { describe('AppSync API Key Authorization', () => { test('AppSync creates default api key', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), }); @@ -24,7 +24,7 @@ describe('AppSync API Key Authorization', () => { test('AppSync creates api key from additionalAuthorizationModes', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -41,7 +41,7 @@ describe('AppSync API Key Authorization', () => { test('AppSync does not create unspecified api key from additionalAuthorizationModes', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -55,7 +55,7 @@ describe('AppSync API Key Authorization', () => { test('appsync does not create unspecified api key with empty additionalAuthorizationModes', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -70,7 +70,7 @@ describe('AppSync API Key Authorization', () => { test('appsync creates configured api key with additionalAuthorizationModes', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -90,7 +90,7 @@ describe('AppSync API Key Authorization', () => { test('appsync creates configured api key with additionalAuthorizationModes (not as first element)', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -117,7 +117,7 @@ describe('AppSync API Key Authorization', () => { test('appsync fails when empty default and API_KEY in additional', () => { // THEN expect(() => { - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -132,7 +132,7 @@ describe('AppSync API Key Authorization', () => { test('appsync fails when multiple API_KEY auth modes', () => { // THEN expect(() => { - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -148,7 +148,7 @@ describe('AppSync API Key Authorization', () => { test('appsync fails when multiple API_KEY auth modes in additionalXxx', () => { // THEN expect(() => { - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -166,7 +166,7 @@ describe('AppSync API Key Authorization', () => { describe('AppSync IAM Authorization', () => { test('Iam authorization configurable in default authorization', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -182,7 +182,7 @@ describe('AppSync IAM Authorization', () => { test('Iam authorization configurable in additional authorization', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -199,7 +199,7 @@ describe('AppSync IAM Authorization', () => { test('appsync fails when multiple iam auth modes', () => { // THEN expect(() => { - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -213,7 +213,7 @@ describe('AppSync IAM Authorization', () => { test('appsync fails when multiple IAM auth modes in additionalXxx', () => { // THEN expect(() => { - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -234,7 +234,7 @@ describe('AppSync User Pool Authorization', () => { }); test('User Pool authorization configurable in default authorization has default configuration', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -258,7 +258,7 @@ describe('AppSync User Pool Authorization', () => { test('User Pool authorization configurable in default authorization', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -287,7 +287,7 @@ describe('AppSync User Pool Authorization', () => { test('User Pool authorization configurable in additional authorization has default configuration', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -312,7 +312,7 @@ describe('AppSync User Pool Authorization', () => { test('User Pool property defaultAction does not configure when in additional auth', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -342,7 +342,7 @@ describe('AppSync User Pool Authorization', () => { test('User Pool property defaultAction does not configure when in additional auth', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -399,7 +399,7 @@ describe('AppSync User Pool Authorization', () => { describe('AppSync OIDC Authorization', () => { test('OIDC authorization configurable in default authorization has default configuration', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -421,7 +421,7 @@ describe('AppSync OIDC Authorization', () => { test('User Pool authorization configurable in default authorization', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -451,7 +451,7 @@ describe('AppSync OIDC Authorization', () => { test('OIDC authorization configurable in additional authorization has default configuration', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -475,7 +475,7 @@ describe('AppSync OIDC Authorization', () => { test('User Pool authorization configurable in additional authorization', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { @@ -507,7 +507,7 @@ describe('AppSync OIDC Authorization', () => { test('User Pool authorization configurable in with multiple authorization', () => { // WHEN - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), authorizationConfig: { diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-code-first.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-code-first.test.ts index 0b39cab4c4c24..98460fd8be00d 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-code-first.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-code-first.test.ts @@ -10,10 +10,10 @@ beforeEach(() => { }); describe('code-first implementation through GraphQL Api functions`', () => { - let api: appsync.GraphQLApi; + let api: appsync.GraphqlApi; beforeEach(() => { // GIVEN - api = new appsync.GraphQLApi(stack, 'api', { + api = new appsync.GraphqlApi(stack, 'api', { name: 'api', }); }); @@ -164,7 +164,7 @@ describe('code-first implementation through Schema functions`', () => { schema.addType(test); test.addField('dupid', t.dup_id); - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema, }); @@ -190,7 +190,7 @@ describe('code-first implementation through Schema functions`', () => { schema.addType(test); test.addField('dupid', t.dup_id); - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema, }); @@ -215,7 +215,7 @@ describe('code-first implementation through Schema functions`', () => { }, })); - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema, }); @@ -241,7 +241,7 @@ describe('code-first implementation through Schema functions`', () => { })); test.addField('dupid', t.dup_id); - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema, }); @@ -265,7 +265,7 @@ describe('code-first implementation through Schema functions`', () => { dupid: t.dup_id, }, })); - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema, }); @@ -290,7 +290,7 @@ describe('code-first implementation through Schema functions`', () => { })); test.addField('dupid', t.dup_id); - new appsync.GraphQLApi(stack, 'api', { + new appsync.GraphqlApi(stack, 'api', { name: 'api', schema, }); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-dynamodb.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-dynamodb.test.ts index e54a9576396d1..07565edd1fba5 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-dynamodb.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-dynamodb.test.ts @@ -10,10 +10,10 @@ function joined(str: string): string { // GLOBAL GIVEN let stack: cdk.Stack; -let api: appsync.GraphQLApi; +let api: appsync.GraphqlApi; beforeEach(() => { stack = new cdk.Stack(); - api = new appsync.GraphQLApi(stack, 'baseApi', { + api = new appsync.GraphqlApi(stack, 'baseApi', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), }); @@ -75,7 +75,7 @@ describe('DynamoDb Data Source configuration', () => { expect(() => { api.addDynamoDbDataSource('ds', table); api.addDynamoDbDataSource('ds', table); - }).toThrow("There is already a Construct with name 'ds' in GraphQLApi [baseApi]"); + }).toThrow("There is already a Construct with name 'ds' in GraphqlApi [baseApi]"); }); }); @@ -160,7 +160,7 @@ describe('adding DynamoDb data source from imported api', () => { test('imported api can add DynamoDbDataSource from id', () => { // WHEN - const importedApi = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'importedApi', { + const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'importedApi', { graphqlApiId: api.apiId, }); importedApi.addDynamoDbDataSource('ds', table); @@ -174,7 +174,7 @@ describe('adding DynamoDb data source from imported api', () => { test('imported api can add DynamoDbDataSource from attributes', () => { // WHEN - const importedApi = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'importedApi', { + const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'importedApi', { graphqlApiId: api.apiId, graphqlApiArn: api.arn, }); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-grant.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-grant.test.ts index 44251cd7fabee..d59b7c5d363cb 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-grant.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-grant.test.ts @@ -6,14 +6,14 @@ import * as appsync from '../lib'; let stack: cdk.Stack; let role: iam.Role; -let api: appsync.GraphQLApi; +let api: appsync.GraphqlApi; beforeEach(() => { // GIVEN stack = new cdk.Stack(); role = new iam.Role(stack, 'Role', { assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), }); - api = new appsync.GraphQLApi(stack, 'API', { + api = new appsync.GraphqlApi(stack, 'API', { name: 'demo', schema: appsync.Schema.fromAsset(join(__dirname, 'appsync.test.graphql')), authorizationConfig: { diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-http.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-http.test.ts index 899a76ebd19f4..6bc237e0f5c71 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-http.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-http.test.ts @@ -5,11 +5,11 @@ import * as appsync from '../lib'; // GLOBAL GIVEN let stack: cdk.Stack; -let api: appsync.GraphQLApi; +let api: appsync.GraphqlApi; let endpoint: string; beforeEach(() => { stack = new cdk.Stack(); - api = new appsync.GraphQLApi(stack, 'baseApi', { + api = new appsync.GraphqlApi(stack, 'baseApi', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), }); @@ -62,14 +62,14 @@ describe('Http Data Source configuration', () => { expect(() => { api.addHttpDataSource('ds', endpoint); api.addHttpDataSource('ds', endpoint); - }).toThrow("There is already a Construct with name 'ds' in GraphQLApi [baseApi]"); + }).toThrow("There is already a Construct with name 'ds' in GraphqlApi [baseApi]"); }); }); describe('adding http data source from imported api', () => { test('imported api can add HttpDataSource from id', () => { // WHEN - const importedApi = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'importedApi', { + const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'importedApi', { graphqlApiId: api.apiId, }); importedApi.addHttpDataSource('ds', endpoint); @@ -83,7 +83,7 @@ describe('adding http data source from imported api', () => { test('imported api can add HttpDataSource from attributes', () => { // WHEN - const importedApi = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'importedApi', { + const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'importedApi', { graphqlApiId: api.apiId, graphqlApiArn: api.arn, }); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-interface-type.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-interface-type.test.ts index 981ec8b60a039..644e7fae42354 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-interface-type.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-interface-type.test.ts @@ -4,11 +4,11 @@ import * as appsync from '../lib'; import * as t from './scalar-type-defintions'; let stack: cdk.Stack; -let api: appsync.GraphQLApi; +let api: appsync.GraphqlApi; beforeEach(() => { // GIVEN stack = new cdk.Stack(); - api = new appsync.GraphQLApi(stack, 'api', { + api = new appsync.GraphqlApi(stack, 'api', { name: 'api', }); }); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-lambda.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-lambda.test.ts index a67fd4b1691b7..0cc8396382017 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-lambda.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-lambda.test.ts @@ -6,10 +6,10 @@ import * as appsync from '../lib'; // GLOBAL GIVEN let stack: cdk.Stack; -let api: appsync.GraphQLApi; +let api: appsync.GraphqlApi; beforeEach(() => { stack = new cdk.Stack(); - api = new appsync.GraphQLApi(stack, 'baseApi', { + api = new appsync.GraphqlApi(stack, 'baseApi', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), }); @@ -70,7 +70,7 @@ describe('Lambda Data Source configuration', () => { expect(() => { api.addLambdaDataSource('ds', func); api.addLambdaDataSource('ds', func); - }).toThrow("There is already a Construct with name 'ds' in GraphQLApi [baseApi]"); + }).toThrow("There is already a Construct with name 'ds' in GraphqlApi [baseApi]"); }); }); @@ -86,7 +86,7 @@ describe('adding lambda data source from imported api', () => { test('imported api can add LambdaDbDataSource from id', () => { // WHEN - const importedApi = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'importedApi', { + const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'importedApi', { graphqlApiId: api.apiId, }); importedApi.addLambdaDataSource('ds', func); @@ -100,7 +100,7 @@ describe('adding lambda data source from imported api', () => { test('imported api can add LambdaDataSource from attributes', () => { // WHEN - const importedApi = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'importedApi', { + const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'importedApi', { graphqlApiId: api.apiId, graphqlApiArn: api.arn, }); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-none.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-none.test.ts index f2b52c7dfba03..3985cebc30719 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-none.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-none.test.ts @@ -5,10 +5,10 @@ import * as appsync from '../lib'; // GLOBAL GIVEN let stack: cdk.Stack; -let api: appsync.GraphQLApi; +let api: appsync.GraphqlApi; beforeEach(() => { stack = new cdk.Stack(); - api = new appsync.GraphQLApi(stack, 'baseApi', { + api = new appsync.GraphqlApi(stack, 'baseApi', { name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), }); @@ -60,7 +60,7 @@ describe('None Data Source configuration', () => { expect(() => { api.addNoneDataSource('ds'); api.addNoneDataSource('ds'); - }).toThrow("There is already a Construct with name 'ds' in GraphQLApi [baseApi]"); + }).toThrow("There is already a Construct with name 'ds' in GraphqlApi [baseApi]"); }); test('appsync errors when creating multiple none data sources with same name configuration', () => { @@ -75,7 +75,7 @@ describe('None Data Source configuration', () => { describe('adding none data source from imported api', () => { test('imported api can add NoneDataSource from id', () => { // WHEN - const importedApi = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'importedApi', { + const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'importedApi', { graphqlApiId: api.apiId, }); importedApi.addNoneDataSource('none'); @@ -89,7 +89,7 @@ describe('adding none data source from imported api', () => { test('imported api can add NoneDataSource from attributes', () => { // WHEN - const importedApi = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'importedApi', { + const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'importedApi', { graphqlApiId: api.apiId, graphqlApiArn: api.arn, }); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-object-type.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-object-type.test.ts index a60a5242f6fe7..02f0d9b43ff57 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-object-type.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-object-type.test.ts @@ -4,11 +4,11 @@ import * as appsync from '../lib'; import * as t from './scalar-type-defintions'; let stack: cdk.Stack; -let api: appsync.GraphQLApi; +let api: appsync.GraphqlApi; beforeEach(() => { // GIVEN stack = new cdk.Stack(); - api = new appsync.GraphQLApi(stack, 'api', { + api = new appsync.GraphqlApi(stack, 'api', { name: 'api', }); }); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-scalar-type.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-scalar-type.test.ts index 64fddd55bc3d3..312d7a3784b98 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-scalar-type.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-scalar-type.test.ts @@ -4,11 +4,11 @@ import * as appsync from '../lib'; import * as t from './scalar-type-defintions'; let stack: cdk.Stack; -let api: appsync.GraphQLApi; +let api: appsync.GraphqlApi; beforeEach(() => { // GIVEN stack = new cdk.Stack(); - api = new appsync.GraphQLApi(stack, 'api', { + api = new appsync.GraphqlApi(stack, 'api', { name: 'api', }); }); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-schema.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync-schema.test.ts index f60d63f1dec5c..95fe1ac7c500a 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-schema.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync-schema.test.ts @@ -36,7 +36,7 @@ describe('basic testing schema definition mode `code`', () => { test('definition mode `code` produces empty schema definition', () => { // WHEN - new appsync.GraphQLApi(stack, 'API', { + new appsync.GraphqlApi(stack, 'API', { name: 'demo', }); @@ -48,7 +48,7 @@ describe('basic testing schema definition mode `code`', () => { test('definition mode `code` generates correct schema with addToSchema', () => { // WHEN - const api = new appsync.GraphQLApi(stack, 'API', { + const api = new appsync.GraphqlApi(stack, 'API', { name: 'demo', }); api.addType(type); @@ -63,7 +63,7 @@ describe('basic testing schema definition mode `code`', () => { test('definition mode `code` allows for api to addQuery', () => { // WHEN - const api = new appsync.GraphQLApi(stack, 'API', { + const api = new appsync.GraphqlApi(stack, 'API', { name: 'demo', }); api.addQuery('test', new appsync.ResolvableField({ @@ -79,7 +79,7 @@ describe('basic testing schema definition mode `code`', () => { test('definition mode `code` allows for schema to addQuery', () => { // WHEN const schema = new appsync.Schema(); - new appsync.GraphQLApi(stack, 'API', { + new appsync.GraphqlApi(stack, 'API', { name: 'demo', schema, }); @@ -95,7 +95,7 @@ describe('basic testing schema definition mode `code`', () => { test('definition mode `code` allows for api to addMutation', () => { // WHEN - const api = new appsync.GraphQLApi(stack, 'API', { + const api = new appsync.GraphqlApi(stack, 'API', { name: 'demo', }); api.addMutation('test', new appsync.ResolvableField({ @@ -111,7 +111,7 @@ describe('basic testing schema definition mode `code`', () => { test('definition mode `code` allows for schema to addMutation', () => { // WHEN const schema = new appsync.Schema(); - new appsync.GraphQLApi(stack, 'API', { + new appsync.GraphqlApi(stack, 'API', { name: 'demo', schema, }); @@ -130,7 +130,7 @@ describe('testing schema definition mode `file`', () => { test('definition mode `file` produces correct output', () => { // WHEN - new appsync.GraphQLApi(stack, 'API', { + new appsync.GraphqlApi(stack, 'API', { name: 'demo', schema: appsync.Schema.fromAsset(join(__dirname, 'appsync.test.graphql')), }); @@ -143,7 +143,7 @@ describe('testing schema definition mode `file`', () => { test('definition mode `file` errors when addType for object is called', () => { // WHEN - const api = new appsync.GraphQLApi(stack, 'API', { + const api = new appsync.GraphqlApi(stack, 'API', { name: 'demo', schema: appsync.Schema.fromAsset(join(__dirname, 'appsync.test.graphql')), }); @@ -158,7 +158,7 @@ describe('testing schema definition mode `file`', () => { test('definition mode `file` errors when addType for interface is called', () => { // WHEN - const api = new appsync.GraphQLApi(stack, 'API', { + const api = new appsync.GraphqlApi(stack, 'API', { name: 'demo', schema: appsync.Schema.fromAsset(join(__dirname, 'appsync.test.graphql')), }); @@ -173,7 +173,7 @@ describe('testing schema definition mode `file`', () => { test('definition mode `file` errors when addToSchema is called', () => { // WHEN - const api = new appsync.GraphQLApi(stack, 'API', { + const api = new appsync.GraphqlApi(stack, 'API', { name: 'demo', schema: appsync.Schema.fromAsset(join(__dirname, 'appsync.test.graphql')), }); @@ -186,7 +186,7 @@ describe('testing schema definition mode `file`', () => { test('definition mode `file` errors when addQuery is called', () => { // WHEN - const api = new appsync.GraphQLApi(stack, 'API', { + const api = new appsync.GraphqlApi(stack, 'API', { name: 'demo', schema: appsync.Schema.fromAsset(join(__dirname, 'appsync.test.graphql')), }); @@ -199,7 +199,7 @@ describe('testing schema definition mode `file`', () => { test('definition mode `file` errors when addMutation is called', () => { // WHEN - const api = new appsync.GraphQLApi(stack, 'API', { + const api = new appsync.GraphqlApi(stack, 'API', { name: 'demo', schema: appsync.Schema.fromAsset(join(__dirname, 'appsync.test.graphql')), }); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync.test.ts index 9dc6808a672e1..debdfa71ce4f0 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync.test.ts @@ -4,10 +4,10 @@ import * as cdk from '@aws-cdk/core'; import * as appsync from '../lib'; let stack: cdk.Stack; -let api: appsync.GraphQLApi; +let api: appsync.GraphqlApi; beforeEach(() => { stack = new cdk.Stack(); - api = new appsync.GraphQLApi(stack, 'api', { + api = new appsync.GraphqlApi(stack, 'api', { authorizationConfig: {}, name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), @@ -61,7 +61,7 @@ test('appsync should configure resolver as unit when pipelineConfig is empty arr test('when xray is enabled should not throw an Error', () => { // WHEN - new appsync.GraphQLApi(stack, 'api-x-ray', { + new appsync.GraphqlApi(stack, 'api-x-ray', { authorizationConfig: {}, name: 'api', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), diff --git a/packages/@aws-cdk/aws-appsync/test/integ.api-import.ts b/packages/@aws-cdk/aws-appsync/test/integ.api-import.ts index b36c6a1bef7b1..8781f83fe117e 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.api-import.ts +++ b/packages/@aws-cdk/aws-appsync/test/integ.api-import.ts @@ -11,7 +11,7 @@ import * as appsync from '../lib'; * * Stack verification steps: * Install dependencies and deploy integration test. Check if data sources are - * connected to the graphQL Api + * connected to the GraphQL Api * * -- cdk deploy --app 'node integ.api-import.js' stack -- start -- * -- aws appsync list-graphql-apis -- obtain api id -- @@ -22,13 +22,13 @@ import * as appsync from '../lib'; const app = new cdk.App(); const baseStack = new cdk.Stack(app, 'baseStack'); -const baseApi = new appsync.GraphQLApi(baseStack, 'baseApi', { +const baseApi = new appsync.GraphqlApi(baseStack, 'baseApi', { name: 'baseApi', schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), }); const stack = new cdk.Stack(app, 'stack'); -const api = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'Api', { +const api = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'Api', { graphqlApiId: `${baseApi.apiId}`, }); @@ -57,7 +57,7 @@ testDS.createResolver({ responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultItem(), }); -const api2 = appsync.GraphQLApi.fromGraphqlApiAttributes(stack, 'api2', { +const api2 = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'api2', { graphqlApiId: baseApi.apiId, graphqlApiArn: baseApi.arn, }); diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.ts b/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.ts index 0d4c95a10ea3f..185fc8ef3e729 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.ts +++ b/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.ts @@ -6,7 +6,7 @@ import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; import { AuthorizationType, - GraphQLApi, + GraphqlApi, MappingTemplate, PrimaryKey, UserPoolDefaultAction, @@ -36,7 +36,7 @@ const userPool = new UserPool(stack, 'Pool', { userPoolName: 'myPool', }); -const api = new GraphQLApi(stack, 'Api', { +const api = new GraphqlApi(stack, 'Api', { name: 'Integ_Test_IAM', schema: Schema.fromAsset(join(__dirname, 'integ.graphql-iam.graphql')), authorizationConfig: { @@ -98,14 +98,14 @@ new Function(stack, 'testQuery', { code: Code.fromAsset('verify'), handler: 'iam-query.handler', runtime: Runtime.NODEJS_12_X, - environment: { APPSYNC_ENDPOINT: api.graphQlUrl }, + environment: { APPSYNC_ENDPOINT: api.graphqlUrl }, role: lambdaIAM, }); new Function(stack, 'testFail', { code: Code.fromAsset('verify'), handler: 'iam-query.handler', runtime: Runtime.NODEJS_12_X, - environment: { APPSYNC_ENDPOINT: api.graphQlUrl }, + environment: { APPSYNC_ENDPOINT: api.graphqlUrl }, }); app.synth(); diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.ts b/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.ts index 8bde313c6f724..8cb3daafab11a 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.ts +++ b/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.ts @@ -29,7 +29,7 @@ const node = schema.addType(new appsync.InterfaceType('Node', { }, })); -const api = new appsync.GraphQLApi(stack, 'code-first-api', { +const api = new appsync.GraphqlApi(stack, 'code-first-api', { name: 'api', schema: schema, }); diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql.ts b/packages/@aws-cdk/aws-appsync/test/integ.graphql.ts index 9882fead1cf12..1de80995c90a0 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.graphql.ts +++ b/packages/@aws-cdk/aws-appsync/test/integ.graphql.ts @@ -4,7 +4,7 @@ import { AttributeType, BillingMode, Table } from '@aws-cdk/aws-dynamodb'; import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; import { AuthorizationType, - GraphQLApi, + GraphqlApi, KeyCondition, MappingTemplate, PrimaryKey, @@ -33,7 +33,7 @@ const userPool = new UserPool(stack, 'Pool', { userPoolName: 'myPool', }); -const api = new GraphQLApi(stack, 'Api', { +const api = new GraphqlApi(stack, 'Api', { name: 'demoapi', schema: Schema.fromAsset(join(__dirname, 'integ.graphql.graphql')), authorizationConfig: {