Skip to content

Commit a936b34

Browse files
authored
Merge pull request #395 from aws-amplify/master
release add null type union to optional fields
2 parents cff6b4d + 48b10f1 commit a936b34

File tree

3 files changed

+90
-86
lines changed

3 files changed

+90
-86
lines changed

packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-javascript-visitor.test.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,22 @@ describe('Javascript visitor', () => {
109109
110110
export declare class SimpleNonModelType {
111111
readonly id: string;
112-
readonly names?: (string | null)[];
112+
readonly names?: (string | null)[] | null;
113113
constructor(init: ModelInit<SimpleNonModelType>);
114114
}
115115
116116
export declare class SimpleModel {
117117
readonly id: string;
118-
readonly name?: string;
119-
readonly bar?: string;
120-
readonly foo?: Bar[];
118+
readonly name?: string | null;
119+
readonly bar?: string | null;
120+
readonly foo?: Bar[] | null;
121121
constructor(init: ModelInit<SimpleModel>);
122122
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel>) => MutableModel<SimpleModel> | void): SimpleModel;
123123
}
124124
125125
export declare class Bar {
126126
readonly id: string;
127-
readonly simpleModelFooId?: string;
127+
readonly simpleModelFooId?: string | null;
128128
constructor(init: ModelInit<Bar>);
129129
static copyOf(source: Bar, mutator: (draft: MutableModel<Bar>) => MutableModel<Bar> | void): Bar;
130130
}"
@@ -158,7 +158,7 @@ describe('Javascript visitor', () => {
158158
159159
export declare class SimpleNonModelType {
160160
readonly id: string;
161-
readonly names?: (string | null)[];
161+
readonly names?: (string | null)[] | null;
162162
constructor(init: ModelInit<SimpleNonModelType>);
163163
}
164164
@@ -172,20 +172,20 @@ describe('Javascript visitor', () => {
172172
173173
export declare class SimpleModel {
174174
readonly id: string;
175-
readonly name?: string;
176-
readonly bar?: string;
177-
readonly foo?: Bar[];
178-
readonly createdAt?: string;
179-
readonly updatedAt?: string;
175+
readonly name?: string | null;
176+
readonly bar?: string | null;
177+
readonly foo?: Bar[] | null;
178+
readonly createdAt?: string | null;
179+
readonly updatedAt?: string | null;
180180
constructor(init: ModelInit<SimpleModel, SimpleModelMetaData>);
181181
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel, SimpleModelMetaData>) => MutableModel<SimpleModel, SimpleModelMetaData> | void): SimpleModel;
182182
}
183183
184184
export declare class Bar {
185185
readonly id: string;
186-
readonly createdAt?: string;
187-
readonly updatedAt?: string;
188-
readonly simpleModelFooId?: string;
186+
readonly createdAt?: string | null;
187+
readonly updatedAt?: string | null;
188+
readonly simpleModelFooId?: string | null;
189189
constructor(init: ModelInit<Bar, BarMetaData>);
190190
static copyOf(source: Bar, mutator: (draft: MutableModel<Bar, BarMetaData>) => MutableModel<Bar, BarMetaData> | void): Bar;
191191
}"
@@ -290,14 +290,14 @@ describe('Javascript visitor with default owner auth', () => {
290290
291291
export declare class SimpleNonModelType {
292292
readonly id: string;
293-
readonly names?: (string | null)[];
293+
readonly names?: (string | null)[] | null;
294294
constructor(init: ModelInit<SimpleNonModelType>);
295295
}
296296
297297
export declare class SimpleModel {
298298
readonly id: string;
299-
readonly name?: string;
300-
readonly bar?: string;
299+
readonly name?: string | null;
300+
readonly bar?: string | null;
301301
constructor(init: ModelInit<SimpleModel>);
302302
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel>) => MutableModel<SimpleModel> | void): SimpleModel;
303303
}"
@@ -359,14 +359,14 @@ describe('Javascript visitor with custom owner field auth', () => {
359359
360360
export declare class SimpleNonModelType {
361361
readonly id: string;
362-
readonly names?: (string | null)[];
362+
readonly names?: (string | null)[] | null;
363363
constructor(init: ModelInit<SimpleNonModelType>);
364364
}
365365
366366
export declare class SimpleModel {
367367
readonly id: string;
368-
readonly name?: string;
369-
readonly bar?: string;
368+
readonly name?: string | null;
369+
readonly bar?: string | null;
370370
constructor(init: ModelInit<SimpleModel>);
371371
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel>) => MutableModel<SimpleModel> | void): SimpleModel;
372372
}"
@@ -430,14 +430,14 @@ describe('Javascript visitor with multiple owner field auth', () => {
430430
431431
export declare class SimpleNonModelType {
432432
readonly id: string;
433-
readonly names?: (string | null)[];
433+
readonly names?: (string | null)[] | null;
434434
constructor(init: ModelInit<SimpleNonModelType>);
435435
}
436436
437437
export declare class SimpleModel {
438438
readonly id: string;
439-
readonly name?: string;
440-
readonly bar?: string;
439+
readonly name?: string | null;
440+
readonly bar?: string | null;
441441
constructor(init: ModelInit<SimpleModel>);
442442
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel>) => MutableModel<SimpleModel> | void): SimpleModel;
443443
}"
@@ -492,7 +492,7 @@ describe('Javascript visitor with auth directives in field level', () => {
492492
readonly id: string;
493493
readonly name: string;
494494
readonly address: string;
495-
readonly ssn?: string;
495+
readonly ssn?: string | null;
496496
constructor(init: ModelInit<Employee>);
497497
static copyOf(source: Employee, mutator: (draft: MutableModel<Employee>) => MutableModel<Employee> | void): Employee;
498498
}"

0 commit comments

Comments
 (0)