fix(appsync): validate type updates before mutation (#8129)

Reject an invalid type format before changing the stored definition.
Keep validation inside the existing synchronized update operation.

Cover the refused request through service and AWS SDK tests, including
unchanged get/list responses and a subsequent successful valid update.

Signed-off-by: Andre Kurait <akurait@amazon.com>
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
Co-authored-by: Andre Kurait <akurait@amazon.com>
This commit is contained in:
Jackson PriceandAndre Kurait authored and GitHub committed 2026-11-12 14:08:04 -04:00
1 parent 5da8045bb2
commit 5d1d626cbe
4 files changed
+85 -3

No files matched your search

@@ -616,9 +616,16 @@ public class AppSyncService {
public synchronized AppSyncType updateType(String apiId, String typeName, Map<String, Object> request) {
assertSchemaNotBusy(apiId);
AppSyncType existing = getType(apiId, typeName);
if (request.containsKey("definition")) existing.setDefinition((String) request.get("definition"));
if (request.containsKey("description")) existing.setDescription((String) request.get("description"));
if (request.containsKey("format")) existing.setFormat(parseEnum(TypeFormat.class, request.get("format")));
TypeFormat format = request.containsKey("format") ? parseEnum(TypeFormat.class, request.get("format")) : null;
if (request.containsKey("definition")) {
existing.setDefinition((String) request.get("definition"));
}
if (request.containsKey("description")) {
existing.setDescription((String) request.get("description"));
}
if (request.containsKey("format")) {
existing.setFormat(format);
}
typeStore.put(apiKey(apiId, typeName), existing);
return existing;
}