Skip to content

Commit 5935528

Browse files
tjleingThomas Leing
and
Thomas Leing
authored
Use better fallback for list query v2 (#2344)
Co-authored-by: Thomas Leing <[email protected]>
1 parent a3f7890 commit 5935528

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

aws-api-appsync/src/main/java/com/amplifyframework/api/aws/AppSyncGraphQLRequest.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -156,19 +156,23 @@ public String getQuery() {
156156
}
157157

158158
String modelName = Casing.capitalizeFirst(modelSchema.getName());
159+
String pluralName = modelSchema.getPluralName() != null &&
160+
!modelSchema.getPluralName().isEmpty()
161+
? Casing.capitalizeFirst(modelSchema.getPluralName())
162+
: modelName + "s";
159163
if (QueryType.LIST.equals(operation)) {
160164
modelName = modelSchema.getListPluralName() != null
161165
&& !modelSchema.getListPluralName().isEmpty()
162166
? Casing.capitalizeFirst(modelSchema.getListPluralName())
163-
: modelName + "s";
167+
: pluralName;
164168
} else if (QueryType.SYNC.equals(operation)) {
165169
// The sync operation name is pluralized using pluralize.js, which uses more complex pluralization rules
166170
// than simply adding an 's' at the end (e.g. baby > babies, person > people, etc). This pluralized name
167171
// is an annotation on the codegen'd model class, so we will just grab it from the ModelSchema.
168172
modelName = modelSchema.getSyncPluralName() != null
169-
&& !modelSchema.getSyncPluralName().isEmpty()
173+
&& !modelSchema.getSyncPluralName().isEmpty()
170174
? Casing.capitalizeFirst(modelSchema.getSyncPluralName())
171-
: Casing.capitalizeFirst(modelSchema.getPluralName());
175+
: pluralName;
172176
}
173177

174178
String operationString =

0 commit comments

Comments
 (0)