Skip to content

Commit 7c16b90

Browse files
authored
Merge pull request #334 from aws-amplify/gqlv2-implicit-models-fix-android
Turn on the shouldUseModelNameFieldInHasManyAndBelongsTo flag for Android
2 parents a39b61d + 6cf1ebb commit 7c16b90

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/appsync-modelgen-plugin/src/__tests__/visitors/gqlv2-regression-tests/__snapshots__/appsync-java-visitor.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ public final class Blog7V2 implements Model {
791791
public static final QueryField NAME = field(\\"Blog7V2\\", \\"name\\");
792792
private final @ModelField(targetType=\\"ID\\", isRequired = true) String id;
793793
private final @ModelField(targetType=\\"String\\", isRequired = true) String name;
794-
private final @ModelField(targetType=\\"Post7V2\\") @HasMany(associatedWith = \\"blog7V2PostsId\\", type = Post7V2.class) List<Post7V2> posts = null;
794+
private final @ModelField(targetType=\\"Post7V2\\") @HasMany(associatedWith = \\"blog\\", type = Post7V2.class) List<Post7V2> posts = null;
795795
private @ModelField(targetType=\\"AWSDateTime\\", isReadOnly = true) Temporal.DateTime createdAt;
796796
private @ModelField(targetType=\\"AWSDateTime\\", isReadOnly = true) Temporal.DateTime updatedAt;
797797
public String getId() {
@@ -968,7 +968,7 @@ public final class Post7V2 implements Model {
968968
private final @ModelField(targetType=\\"ID\\", isRequired = true) String id;
969969
private final @ModelField(targetType=\\"String\\", isRequired = true) String title;
970970
private final @ModelField(targetType=\\"Blog7V2\\") @BelongsTo(targetName = \\"blog7V2PostsId\\", type = Blog7V2.class) Blog7V2 blog;
971-
private final @ModelField(targetType=\\"Comment7V2\\") @HasMany(associatedWith = \\"post7V2CommentsId\\", type = Comment7V2.class) List<Comment7V2> comments = null;
971+
private final @ModelField(targetType=\\"Comment7V2\\") @HasMany(associatedWith = \\"post\\", type = Comment7V2.class) List<Comment7V2> comments = null;
972972
private @ModelField(targetType=\\"AWSDateTime\\", isReadOnly = true) Temporal.DateTime createdAt;
973973
private @ModelField(targetType=\\"AWSDateTime\\", isReadOnly = true) Temporal.DateTime updatedAt;
974974
public String getId() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class AppSyncModelJavaVisitor<
2727

2828
generate(): string {
2929
// TODO: Remove us, leaving in to be explicit on why this flag is here.
30-
const shouldUseModelNameFieldInHasManyAndBelongsTo = false;
30+
const shouldUseModelNameFieldInHasManyAndBelongsTo = true;
3131
this.processDirectives(shouldUseModelNameFieldInHasManyAndBelongsTo);
3232
if (this._parsedConfig.generate === 'loader') {
3333
return this.generateClassLoader();

0 commit comments

Comments
 (0)