Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(appsync): implement directives for code-first approach #9973

Merged
merged 106 commits into from
Sep 3, 2020
Merged
Changes from 1 commit
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
46df9f0
complete SchemaBaseType
BryanPan342 Jul 22, 2020
84a7b4c
add doc strings to some classes
BryanPan342 Jul 23, 2020
f3350e3
Merge branch 'master' into appsync-schema
BryanPan342 Jul 23, 2020
ede2020
preliminary changes
BryanPan342 Jul 24, 2020
d9271ec
create enum for schemaDefinition
BryanPan342 Jul 28, 2020
7904e62
adjusted SchemaDefinition to allow for S3
BryanPan342 Jul 28, 2020
4591a70
change addType to addDefinition for temporary inclusion
BryanPan342 Jul 28, 2020
da20dcd
s3 testing
BryanPan342 Jul 28, 2020
6ede81e
Merge branch 'master' into shema
BryanPan342 Aug 3, 2020
4d48a2d
prelim changes
BryanPan342 Aug 3, 2020
63e35b3
prelim run of addType
BryanPan342 Aug 3, 2020
1b82340
reorg schema functions
BryanPan342 Aug 3, 2020
fad768a
== to ===
BryanPan342 Aug 3, 2020
5bec482
chore up schema functions
BryanPan342 Aug 3, 2020
96021db
remove readme section on s3 assets
BryanPan342 Aug 3, 2020
0184c25
remove unneccessary prop this.types
BryanPan342 Aug 3, 2020
2a7c641
remove props
BryanPan342 Aug 3, 2020
076ebdf
expected json file
BryanPan342 Aug 3, 2020
a351a04
listing implementation corrected
BryanPan342 Aug 3, 2020
8637009
update readme
BryanPan342 Aug 3, 2020
0ecd95f
fix bug in integ
BryanPan342 Aug 3, 2020
7005315
pls fix build bug
BryanPan342 Aug 3, 2020
28f7e93
add todo
BryanPan342 Aug 3, 2020
fc98566
dont change list or required
BryanPan342 Aug 4, 2020
c27a158
prelim testing for the OO design
BryanPan342 Aug 5, 2020
72d8be4
new implementation
BryanPan342 Aug 6, 2020
bff3e3b
oops.. forgot to stage changes
BryanPan342 Aug 6, 2020
47d9c89
revert changes to prevent merge conflicts
BryanPan342 Aug 6, 2020
1e2dd60
updated api for generating attribute types
BryanPan342 Aug 7, 2020
d8ee61c
Merge branch 'master' into shema
BryanPan342 Aug 8, 2020
1d1aec9
round off integ test, clean up writing, change api name
BryanPan342 Aug 10, 2020
81563c0
Merge branch 'shema' of https://github.com/BryanPan342/aws-cdk into s…
BryanPan342 Aug 10, 2020
a1e34a3
chore up readme
BryanPan342 Aug 10, 2020
e7b57a4
chore up unit tests
BryanPan342 Aug 10, 2020
7c8115f
allow for object types to be created externally
BryanPan342 Aug 10, 2020
04705e4
update integ for external object type
BryanPan342 Aug 10, 2020
bd6868c
prevent faiils
BryanPan342 Aug 10, 2020
050b160
clean up code and finish up readme for object types
BryanPan342 Aug 10, 2020
08aa720
style change to readme
BryanPan342 Aug 10, 2020
d5bd67c
interfaces implemented
BryanPan342 Aug 11, 2020
14093f6
implemeneted resolvable fields
BryanPan342 Aug 13, 2020
315ffbf
clean up some implementation and some docs
BryanPan342 Aug 13, 2020
66b3685
Merge branch 'shema' into resolvable-fields
BryanPan342 Aug 13, 2020
de4c2ad
edit schema
BryanPan342 Aug 13, 2020
2dc962b
make sure implement interface is appended
BryanPan342 Aug 13, 2020
dfbe57d
Merge branch 'shema' into resolvable-fields
BryanPan342 Aug 14, 2020
912a674
bug fix
BryanPan342 Aug 14, 2020
8bf6ef5
Merge branch 'shema' into resolvable-fields
BryanPan342 Aug 14, 2020
6511d86
fix a bug in implementation
BryanPan342 Aug 14, 2020
beee254
update code-first example on readme
BryanPan342 Aug 14, 2020
dac080d
Merge branch 'master' into resolvable-fields
BryanPan342 Aug 15, 2020
a45ab5c
make resolvable fields as part of graphql type
BryanPan342 Aug 17, 2020
9a6fb99
separate and create IField Interface
BryanPan342 Aug 17, 2020
72cad42
write test cases
BryanPan342 Aug 17, 2020
e0bb9c0
remove unneccessary static function
BryanPan342 Aug 18, 2020
bf1133c
Merge branch 'master' into resolvable-fields
BryanPan342 Aug 18, 2020
3478a47
first pass changes
BryanPan342 Aug 18, 2020
1c549b5
write tests and fix bugs
BryanPan342 Aug 18, 2020
988d2da
remove unneccessary function
BryanPan342 Aug 18, 2020
2f42e64
bug fix
BryanPan342 Aug 18, 2020
f938da8
update test
BryanPan342 Aug 18, 2020
6eb781f
update Readme and make interface for intermediate type
BryanPan342 Aug 19, 2020
2d89379
remove spacing
BryanPan342 Aug 19, 2020
1100f1f
add links
BryanPan342 Aug 19, 2020
57fcb03
address issue
BryanPan342 Aug 20, 2020
783415c
Merge branch 'master' into resolvable-fields
BryanPan342 Aug 20, 2020
11d0f3d
lint
BryanPan342 Aug 20, 2020
b804c15
separating schema from graphql api
BryanPan342 Aug 21, 2020
d0fddda
update readme
BryanPan342 Aug 21, 2020
3d3fa2b
fix suggestions
BryanPan342 Aug 21, 2020
cb6a21b
Merge branch 'master' into resolvable-fields
BryanPan342 Aug 21, 2020
911c87d
implement pipelineConfig + refactor
BryanPan342 Aug 24, 2020
f4df2aa
Merge branch 'master' into schema
BryanPan342 Aug 24, 2020
c23029f
update readme
BryanPan342 Aug 24, 2020
8d510fb
api changes
BryanPan342 Aug 24, 2020
abd1057
fix readme
BryanPan342 Aug 24, 2020
c0e4642
Merge branch 'resolvable-fields' into schema
BryanPan342 Aug 24, 2020
c8408e0
add tests
BryanPan342 Aug 24, 2020
0fd0f2c
allow public definition
BryanPan342 Aug 24, 2020
ba9f337
Merge branch 'master' into schema
BryanPan342 Aug 24, 2020
7ffe7c7
address changes
BryanPan342 Aug 25, 2020
70d584e
update readme
BryanPan342 Aug 25, 2020
8bb0a2a
address suggestions
BryanPan342 Aug 25, 2020
f08f4b8
Merge branch 'master' into schema
BryanPan342 Aug 25, 2020
b3f6843
jsii bug
BryanPan342 Aug 25, 2020
bace345
create baseline for tests directives
BryanPan342 Aug 25, 2020
5988828
test custom
BryanPan342 Aug 25, 2020
a7aed1f
Merge branch 'master' into directives
BryanPan342 Aug 26, 2020
79ec1e1
Merge branch 'master' into directives
BryanPan342 Aug 27, 2020
7d1acce
update directives
BryanPan342 Aug 27, 2020
99c1850
Merge branch 'directives' of https://github.com/BryanPan342/aws-cdk i…
BryanPan342 Aug 27, 2020
d6c10dd
update readme
BryanPan342 Aug 27, 2020
4e540cf
Merge branch 'master' into directives
BryanPan342 Aug 27, 2020
ae07890
Merge branch 'master' into directives
BryanPan342 Aug 31, 2020
f3c77e3
refactor(appsync): graphQLApi to graphqlApi for better snakecasing
BryanPan342 Aug 31, 2020
51edc01
Revert "refactor(appsync): graphQLApi to graphqlApi for better snakec…
BryanPan342 Aug 31, 2020
884e185
Merge remote-tracking branch 'upstream/master'
BryanPan342 Aug 31, 2020
b9d0d63
simplify public api for cognito and add check for modes in directives
BryanPan342 Sep 1, 2020
a4c3de9
Merge branch 'master' into directives
BryanPan342 Sep 1, 2020
9ad9d36
Merge remote-tracking branch 'upstream/master'
BryanPan342 Sep 1, 2020
d9ebafb
Merge remote-tracking branch 'upstream/master'
BryanPan342 Sep 1, 2020
64db87e
Merge remote-tracking branch 'upstream/master'
BryanPan342 Sep 1, 2020
b3622b0
Merge remote-tracking branch 'upstream/master'
BryanPan342 Sep 1, 2020
ef1e75e
Merge branch 'master' into directives
BryanPan342 Sep 1, 2020
f641d56
address comments
BryanPan342 Sep 1, 2020
aeb44f9
Merge branch 'master' into directives
mergify[bot] Sep 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
implemeneted resolvable fields
BryanPan342 committed Aug 13, 2020
commit 14093f623e26996213a26ac535d7d6411b10062e
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import { IFunction } from '@aws-cdk/aws-lambda';
import { Construct, Duration, IResolvable, Stack } from '@aws-cdk/core';
import { CfnApiKey, CfnGraphQLApi, CfnGraphQLSchema } from './appsync.generated';
import { DynamoDbDataSource, HttpDataSource, LambdaDataSource, NoneDataSource } from './data-source';
import { ObjectType, ObjectTypeProps } from './schema-types';
import { ObjectType, ObjectTypeProps, InterfaceType } from './schema-types';

/**
* enum with all possible values for AppSync authorization type
@@ -715,7 +715,7 @@ export class GraphQLApi extends Construct {
* @param delimiter the delimiter between schema and addition
* @default - ''
*/
public appendToSchema(addition: string | ObjectType, delimiter?: string): void {
public appendToSchema(addition: string | ObjectType | InterfaceType, delimiter?: string): void {
if ( this.schemaMode != SchemaDefinition.CODE ) {
throw new Error('API cannot append to schema because schema definition mode is not configured as CODE.');
}
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-appsync/lib/index.ts
Original file line number Diff line number Diff line change
@@ -5,4 +5,5 @@ export * from './data-source';
export * from './mapping-template';
export * from './resolver';
export * from './schema-types';
export * from './schema-utils';
export * from './graphqlapi';
343 changes: 140 additions & 203 deletions packages/@aws-cdk/aws-appsync/lib/schema-types.ts
Original file line number Diff line number Diff line change
@@ -1,153 +1,6 @@
/**
* Directives for types
*
* i.e. @aws_iam or @aws_subscribe
*/
export class Directive {
/**
* Add the @aws_iam directive
*/
public static iam(): Directive{
return new Directive('@aws_iam');
}

/**
* Add a custom directive
*
* @param statement - the directive statement to append
* Note: doesn't guarantee functionality
*/
public static custom(statement: string): Directive {
return new Directive(statement);
}

/**
* the directive statement
*/
public readonly statement: string;

private constructor(statement: string) { this.statement = statement; }
}

/**
* Properties for configuring an type
*
* @param definition - the variables and types that define this type
* i.e. { string: GraphqlType, string: GraphqlType }
*/
export interface BaseTypeProps {
/**
* the attributes of this type
*/
readonly definition: { [key: string]: GraphqlType };
}

/**
* Properties for configuring an Interface Type
*/
export class InterfaceType {
/**
* the name of this type
*/
public readonly name: string;
/**
* the attributes of this type
*/
public readonly definition: { [key: string]: GraphqlType };

public constructor(name: string, props: BaseTypeProps) {
this.name = name;
this.definition = props.definition;
}
}

/**
* Properties for configuring an Object Type
*
* @param definition - the variables and types that define this type
* i.e. { string: GraphqlType, string: GraphqlType }
* @param directives - the directives for this object type
*/
export interface ObjectTypeProps extends BaseTypeProps {
/**
* the directives for this object type
*
* @default - no directives
*/
readonly directives?: Directive [];
}

/**
* Object Types are types declared by you.
*/
export class ObjectType extends InterfaceType {
/**
* A method to define Object Types from an interface
*/
public static fromInterface(name: string, interfaceType: InterfaceType, props: ObjectTypeProps): ObjectType {
return new ObjectType(name, {
definition: Object.assign({}, props.definition, interfaceType.definition),
directives: props.directives,
});
}
/**
* the directives for this object type
*
* @default - no directives
*/
public readonly directives?: Directive[];

public constructor(name: string, props: ObjectTypeProps) {
super(name, props);
this.directives = props.directives;
}

/**
* Create an GraphQL Type representing this Object Type
*
* @param options the options to configure this attribute
* - isList
* - isRequired
* - isRequiredList
*/
public attribute(options?: BaseGraphqlTypeOptions): GraphqlType{
return GraphqlType.graphqlObject({
isList: options?.isList,
isRequired: options?.isRequired,
isRequiredList: options?.isRequiredList,
objectType: this,
});
}

/**
* Generate the string of this object type
*/
public toString(): string {
const directives = this.generateDirectives(this.directives);
let schemaAddition = `type ${this.name} ${directives}{\n`;
Object.keys(this.definition).forEach( (key) => {
const attribute = this.definition[key];
schemaAddition = `${schemaAddition} ${key}: ${attribute.toString()}\n`;
});
return `${schemaAddition}}`;
}

/**
* Utility function to generate directives
*
* @param directives the directives of a given type
* @param delimiter the separator betweeen directives
* @default - ' '
*/
private generateDirectives(directives?: Directive[], delimiter?: string): string{
let schemaAddition = '';
if (!directives){ return schemaAddition; }
directives.map((directive) => {
schemaAddition = `${schemaAddition}${directive.statement}${delimiter ?? ' '}`;
});
return schemaAddition;
}
}
import { Resolver } from './resolver';
import { Directive, Type, ResolvableField, ResolvableFieldOptions } from './schema-utils';
import { BaseDataSource } from './data-source';

/**
* Base options for GraphQL Types
@@ -457,89 +310,173 @@ export class GraphqlType {
}

/**
* Enum containing the Types that can be used to define ObjectTypes
* Properties for configuring an type
*
* @param definition - the variables and types that define this type
* i.e. { string: GraphqlType, string: GraphqlType }
*/
export enum Type {
/**
* `ID` scalar type is a unique identifier. `ID` type is serialized similar to `String`.
*
* Often used as a key for a cache and not intended to be human-readable.
*/
ID = 'ID',
/**
* `String` scalar type is a free-form human-readable text.
*/
STRING = 'String',
export interface BaseTypeProps {
/**
* `Int` scalar type is a signed non-fractional numerical value.
* the attributes of this type
*/
INT = 'Int',
readonly definition: { [key: string]: GraphqlType | ResolvableField };
}

/**
* Properties for configuring an Interface Type
*/
export class InterfaceType {
/**
* `Float` scalar type is a signed double-precision fractional value.
* the name of this type
*/
FLOAT = 'Float',
public readonly name: string;
/**
* `Boolean` scalar type is a boolean value: true or false.
* the attributes of this type
*/
BOOLEAN = 'Boolean',
public readonly definition: { [key: string]: GraphqlType | ResolvableField };

public constructor(name: string, props: BaseTypeProps) {
this.name = name;
this.definition = props.definition;
}

/**
* `AWSDate` scalar type represents a valid extended `ISO 8601 Date` string.
*
* In other words, accepts date strings in the form of `YYYY-MM-DD`. It accepts time zone offsets.
*
* @see https://en.wikipedia.org/wiki/ISO_8601#Calendar_dates
* Generate the string of this object type
*/
AWS_DATE = 'AWSDate',
public toString(): string {
let schemaAddition = `interface ${this.name}{\n`;
Object.keys(this.definition).forEach( (key) => {
const attribute = this.definition[key];
schemaAddition = `${schemaAddition} ${key}: ${attribute.toString()}\n`;
});
return `${schemaAddition}}`;
}
}

/**
* Properties for configuring an Object Type
*
* @param definition - the variables and types that define this type
* i.e. { string: GraphqlType, string: GraphqlType }
* @param directives - the directives for this object type
*/
export interface ObjectTypeProps extends BaseTypeProps {
/**
* `AWSTime` scalar type represents a valid extended `ISO 8601 Time` string.
*
* In other words, accepts date strings in the form of `hh:mm:ss.sss`. It accepts time zone offsets.
* the directives for this object type
*
* @see https://en.wikipedia.org/wiki/ISO_8601#Times
* @default - no directives
*/
AWS_TIME = 'AWSTime',
readonly directives?: Directive[];
}

/**
* Object Types are types declared by you.
*/
export class ObjectType extends InterfaceType {
/**
* `AWSDateTime` scalar type represents a valid extended `ISO 8601 DateTime` string.
*
* In other words, accepts date strings in the form of `YYYY-MM-DDThh:mm:ss.sssZ`. It accepts time zone offsets.
*
* @see https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations
* A method to define Object Types from an interface
*/
AWS_DATE_TIME = 'AWSDateTime',
public static fromInterface(name: string, interfaceType: InterfaceType, props: ObjectTypeProps): ObjectType {
return new ObjectType(name, {
definition: Object.assign({}, props.definition, interfaceType.definition),
directives: props.directives,
});
}
/**
* `AWSTimestamp` scalar type represents the number of seconds since `1970-01-01T00:00Z`.
* the directives for this object type
*
* Timestamps are serialized and deserialized as numbers.
* @default - no directives
*/
AWS_TIMESTAMP = 'AWSTimestamp',
public readonly directives?: Directive[];
/**
* `AWSEmail` scalar type represents an email address string (i.e.`username@example.com`)
* The resolvers linked to this data source
*/
AWS_EMAIL = 'AWSEmail',
public resolvers?: Resolver[];

public constructor(name: string, props: ObjectTypeProps) {
super(name, props);
this.directives = props.directives;

Object.keys(this.definition).forEach((fieldName) => {
const fieldInfo = this.definition[fieldName];
if(fieldInfo instanceof ResolvableField) {
this.resolvers?.push(this.generateResolver(fieldName, fieldInfo));
}
});
}

/**
* `AWSJson` scalar type represents a JSON string.
* Create an GraphQL Type representing this Object Type
*
* @param options the options to configure this attribute
* - isList
* - isRequired
* - isRequiredList
*/
AWS_JSON = 'AWSJSON',
public attribute(options?: BaseGraphqlTypeOptions): GraphqlType{
return GraphqlType.graphqlObject({
isList: options?.isList,
isRequired: options?.isRequired,
isRequiredList: options?.isRequiredList,
objectType: this,
});
}

/**
* `AWSURL` scalar type represetns a valid URL string.
* Add a resolvable field to this Object Type
*
* URLs wihtout schemes or contain double slashes are considered invalid.
* @param fieldName -
* @param type -
* @param dataSource -
* @param options -
*/
AWS_URL = 'AWSURL',
public addResolvableField(fieldName: string, type: GraphqlType, dataSource: BaseDataSource, options?: ResolvableFieldOptions): Resolver{
const resolvableField = new ResolvableField(type, dataSource, options);
const resolver = this.generateResolver(fieldName, resolvableField);
this.resolvers?.push(resolver);
this.definition[fieldName] = resolvableField;
return resolver;
}

/**
* `AWSPhone` scalar type represents a valid phone number. Phone numbers maybe be whitespace delimited or hyphenated.
*
* The number can specify a country code at the beginning, but is not required for US phone numbers.
* Generate the string of this object type
*/
AWS_PHONE = 'AWSPhone',
public toString(): string {
const directives = this.generateDirectives(this.directives);
let schemaAddition = `type ${this.name} ${directives}{\n`;
Object.keys(this.definition).forEach( (key) => {
const attribute = this.definition[key];
const args = attribute instanceof ResolvableField ? attribute.argsToString() : '';
schemaAddition = `${schemaAddition} ${key}${args}: ${attribute.toString()}\n`;
});
return `${schemaAddition}}`;
}

/**
* `AWSIPAddress` scalar type respresents a valid `IPv4` of `IPv6` address string.
* Utility function to generate directives
*
* @param directives the directives of a given type
* @param delimiter the separator betweeen directives
* @default - ' '
*/
AWS_IP_ADDRESS = 'AWSIPAddress',
private generateDirectives(directives?: Directive[], delimiter?: string): string{
let schemaAddition = '';
if (!directives){ return schemaAddition; }
directives.map((directive) => {
schemaAddition = `${schemaAddition}${directive.statement}${delimiter ?? ' '}`;
});
return schemaAddition;
}

/**
* Type used for Object Types
* Generate the resolvers linked to this Object Type
*/
OBJECT = 'OBJECT',
protected generateResolver(fieldName: string, resolvableField: ResolvableField): Resolver{
return resolvableField.dataSource.createResolver({
typeName: this.name,
fieldName: fieldName,
requestMappingTemplate: resolvableField.requestMappingTemplate,
responseMappingTemplate: resolvableField.responseMappingTemplate,
});
}
}
221 changes: 221 additions & 0 deletions packages/@aws-cdk/aws-appsync/lib/schema-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
import { BaseDataSource } from './data-source';
import { MappingTemplate } from './mapping-template';
import { GraphqlType } from './schema-types';

/**
* Directives for types
*
* i.e. @aws_iam or @aws_subscribe
*/
export class Directive {
/**
* Add the @aws_iam directive
*/
public static iam(): Directive{
return new Directive('@aws_iam');
}

/**
* Add a custom directive
*
* @param statement - the directive statement to append
* Note: doesn't guarantee functionality
*/
public static custom(statement: string): Directive {
return new Directive(statement);
}

/**
* the directive statement
*/
public readonly statement: string;

private constructor(statement: string) { this.statement = statement; }
}

/**
* Properties for configuring a resolvable field
*
* @options args - the variables and types that define the arguments
*
* i.e. { string: GraphqlType, string: GraphqlType }
*
* @options requestMappingTemplate - the mapping template for requests to this resolver
* @options responseMappingTemplate - the mapping template for responses from this resolver
*/
export interface ResolvableFieldOptions {
/**
* The arguments for this resolvable field.
*
* i.e. type Example (first: String second: String) {}
* - where 'first' and 'second' are key values for args
* and 'String' is the GraphqlType
*
* @default - no arguments
*/
readonly args?: { [key: string]: GraphqlType };
/**
* The request mapping template for this resolver
*
* @default - No mapping template
*/
readonly requestMappingTemplate?: MappingTemplate;
/**
* The response mapping template for this resolver
*
* @default - No mapping template
*/
readonly responseMappingTemplate?: MappingTemplate;
}

/**
* Resolvable Fields build upon Graphql Types and provide fields
* that can resolve into operations on a data source.
*/
export class ResolvableField {
/**
* The return type for this field
*/
readonly graphqlType: GraphqlType;
/**
* The data source creating linked to this resolvable field
*/
readonly dataSource: BaseDataSource;
/**
* The arguments for this resolvable field.
*
* i.e. type Example (first: String second: String) {}
* - where 'first' and 'second' are key values for args
* and 'String' is the GraphqlType
*
* @default - no arguments
*/
readonly args?: { [key: string]: GraphqlType };
/**
* The request mapping template for this resolver
*
* @default - No mapping template
*/
readonly requestMappingTemplate?: MappingTemplate;
/**
* The response mapping template for this resolver
*
* @default - No mapping template
*/
readonly responseMappingTemplate?: MappingTemplate;

public constructor(type: GraphqlType, dataSource: BaseDataSource, options?: ResolvableFieldOptions) {
this.graphqlType = type;
this.dataSource = dataSource;
this.args = options?.args;
this.requestMappingTemplate = options?.requestMappingTemplate;
this.responseMappingTemplate = options?.responseMappingTemplate;
}

/**
* Generate the string of this resolvable field
*/
public toString(): string{
return this.graphqlType.toString();
}

/**
* Generate the args string of this resolvable field
*/
public argsToString(): string{
let args = '( ';
Object.keys(this.args ?? {}).forEach((key) => {
const type = this.args?.[key].toString();
args = `${args}${key}: ${type} `;
});
return `${args})`;
}
}

/**
* Enum containing the Types that can be used to define ObjectTypes
*/
export enum Type {
/**
* `ID` scalar type is a unique identifier. `ID` type is serialized similar to `String`.
*
* Often used as a key for a cache and not intended to be human-readable.
*/
ID = 'ID',
/**
* `String` scalar type is a free-form human-readable text.
*/
STRING = 'String',
/**
* `Int` scalar type is a signed non-fractional numerical value.
*/
INT = 'Int',
/**
* `Float` scalar type is a signed double-precision fractional value.
*/
FLOAT = 'Float',
/**
* `Boolean` scalar type is a boolean value: true or false.
*/
BOOLEAN = 'Boolean',

/**
* `AWSDate` scalar type represents a valid extended `ISO 8601 Date` string.
*
* In other words, accepts date strings in the form of `YYYY-MM-DD`. It accepts time zone offsets.
*
* @see https://en.wikipedia.org/wiki/ISO_8601#Calendar_dates
*/
AWS_DATE = 'AWSDate',
/**
* `AWSTime` scalar type represents a valid extended `ISO 8601 Time` string.
*
* In other words, accepts date strings in the form of `hh:mm:ss.sss`. It accepts time zone offsets.
*
* @see https://en.wikipedia.org/wiki/ISO_8601#Times
*/
AWS_TIME = 'AWSTime',
/**
* `AWSDateTime` scalar type represents a valid extended `ISO 8601 DateTime` string.
*
* In other words, accepts date strings in the form of `YYYY-MM-DDThh:mm:ss.sssZ`. It accepts time zone offsets.
*
* @see https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations
*/
AWS_DATE_TIME = 'AWSDateTime',
/**
* `AWSTimestamp` scalar type represents the number of seconds since `1970-01-01T00:00Z`.
*
* Timestamps are serialized and deserialized as numbers.
*/
AWS_TIMESTAMP = 'AWSTimestamp',
/**
* `AWSEmail` scalar type represents an email address string (i.e.`username@example.com`)
*/
AWS_EMAIL = 'AWSEmail',
/**
* `AWSJson` scalar type represents a JSON string.
*/
AWS_JSON = 'AWSJSON',
/**
* `AWSURL` scalar type represetns a valid URL string.
*
* URLs wihtout schemes or contain double slashes are considered invalid.
*/
AWS_URL = 'AWSURL',
/**
* `AWSPhone` scalar type represents a valid phone number. Phone numbers maybe be whitespace delimited or hyphenated.
*
* The number can specify a country code at the beginning, but is not required for US phone numbers.
*/
AWS_PHONE = 'AWSPhone',
/**
* `AWSIPAddress` scalar type respresents a valid `IPv4` of `IPv6` address string.
*/
AWS_IP_ADDRESS = 'AWSIPAddress',

/**
* Type used for Object Types
*/
OBJECT = 'OBJECT',
}