Skip to content

Commit 4846f83

Browse files
committed
fix: update JS/TS MIPR
1 parent 93d6cf2 commit 4846f83

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-json-metadata-visitor.test.ts.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,8 @@ exports[`Metadata visitor for custom PK support relation metadata for hasOne/bel
615615
\\"association\\": {
616616
\\"connectionType\\": \\"HAS_ONE\\",
617617
\\"associatedWith\\": [
618-
\\"project\\"
618+
\\"id\\",
619+
\\"name\\"
619620
],
620621
\\"targetNames\\": [
621622
\\"projectTeamId\\",
@@ -795,7 +796,8 @@ export const schema: Schema = {
795796
\\"association\\": {
796797
\\"connectionType\\": \\"HAS_ONE\\",
797798
\\"associatedWith\\": [
798-
\\"project\\"
799+
\\"id\\",
800+
\\"name\\"
799801
],
800802
\\"targetNames\\": [
801803
\\"projectTeamId\\",

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ export class AppSyncModelJavascriptVisitor<
4747
const shouldUseModelNameFieldInHasManyAndBelongsTo = false;
4848
// This flag is going to be used to tight-trigger on JS implementations only.
4949
const shouldImputeKeyForUniDirectionalHasMany = true;
50+
const shouldUseFieldsInAssociatedWithInHasOne = true;
5051
this.processDirectives(
5152
shouldUseModelNameFieldInHasManyAndBelongsTo,
52-
shouldImputeKeyForUniDirectionalHasMany
53+
shouldImputeKeyForUniDirectionalHasMany,
54+
shouldUseFieldsInAssociatedWithInHasOne
5355
);
5456

5557
if (this._parsedConfig.isDeclaration) {

packages/appsync-modelgen-plugin/src/visitors/appsync-json-metadata-visitor.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,12 @@ export class AppSyncJSONVisitor<
114114
const shouldUseModelNameFieldInHasManyAndBelongsTo = false;
115115
// This flag is going to be used to tight-trigger on JS implementations only.
116116
const shouldImputeKeyForUniDirectionalHasMany = true;
117+
const shouldUseFieldsInAssociatedWithInHasOne = true;
118+
117119
this.processDirectives(
118120
shouldUseModelNameFieldInHasManyAndBelongsTo,
119-
shouldImputeKeyForUniDirectionalHasMany
121+
shouldImputeKeyForUniDirectionalHasMany,
122+
shouldUseFieldsInAssociatedWithInHasOne
120123
);
121124

122125
if (this._parsedConfig.metadataTarget === 'typescript') {

packages/appsync-modelgen-plugin/src/visitors/appsync-typescript-visitor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ export class AppSyncModelTypeScriptVisitor<
4444
const shouldUseModelNameFieldInHasManyAndBelongsTo = false;
4545
// This flag is going to be used to tight-trigger on JS implementations only.
4646
const shouldImputeKeyForUniDirectionalHasMany = true;
47+
const shouldUseFieldsInAssociatedWithInHasOne = true;
4748
this.processDirectives(
4849
shouldUseModelNameFieldInHasManyAndBelongsTo,
49-
shouldImputeKeyForUniDirectionalHasMany
50+
shouldImputeKeyForUniDirectionalHasMany,
51+
shouldUseFieldsInAssociatedWithInHasOne
5052
);
5153
const imports = this.generateImports();
5254
const enumDeclarations = Object.values(this.enumMap)

0 commit comments

Comments
 (0)