Skip to content

Commit

Permalink
refactor(appsync): graphQLApi to graphqlApi for better snakecasing
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanPan342 committed Aug 31, 2020
1 parent 34f40b9 commit f3c77e3
Show file tree
Hide file tree
Showing 19 changed files with 95 additions and 96 deletions.
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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}`,
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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
Expand All @@ -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 ??
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-appsync/lib/schema.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-appsync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
46 changes: 23 additions & 23 deletions packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
});
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down
16 changes: 8 additions & 8 deletions packages/@aws-cdk/aws-appsync/test/appsync-code-first.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
});
Expand Down Expand Up @@ -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,
});
Expand All @@ -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,
});
Expand All @@ -215,7 +215,7 @@ describe('code-first implementation through Schema functions`', () => {
},
}));

new appsync.GraphQLApi(stack, 'api', {
new appsync.GraphqlApi(stack, 'api', {
name: 'api',
schema,
});
Expand All @@ -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,
});
Expand All @@ -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,
});
Expand All @@ -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,
});
Expand Down
10 changes: 5 additions & 5 deletions packages/@aws-cdk/aws-appsync/test/appsync-dynamodb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
});
Expand Down Expand Up @@ -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]");
});
});

Expand Down Expand Up @@ -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);
Expand All @@ -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,
});
Expand Down
Loading

0 comments on commit f3c77e3

Please sign in to comment.