@aws-amplify/data-schema 1.20.0 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/data-schema",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1444,8 +1444,24 @@ function generateInputTypes(
1444
1444
  if (isRefField(argDef)) {
1445
1445
  const refType = getRefType(argDef.data.link, operationName);
1446
1446
  if (refType.type === 'CustomType') {
1447
+ const { valueRequired, array, arrayRequired } = argDef.data;
1448
+
1447
1449
  const inputTypeName = `${argDef.data.link}Input`;
1448
- argDefinitions.push(`${argName}: ${inputTypeName}`);
1450
+ let field = inputTypeName;
1451
+
1452
+ if (valueRequired === true) {
1453
+ field += '!';
1454
+ }
1455
+
1456
+ if (array) {
1457
+ field = `[${field}]`;
1458
+
1459
+ if (arrayRequired === true) {
1460
+ field += '!';
1461
+ }
1462
+ }
1463
+
1464
+ argDefinitions.push(`${argName}: ${field}`);
1449
1465
 
1450
1466
  // Process the input type if it hasn't been processed yet
1451
1467
  if (!processedTypes.has(inputTypeName)) {
@@ -1462,7 +1478,23 @@ function generateInputTypes(
1462
1478
  });
1463
1479
  }
1464
1480
  } else if (refType.type === 'Enum') {
1465
- argDefinitions.push(`${argName}: ${argDef.data.link}`);
1481
+ const { valueRequired, array, arrayRequired } = argDef.data;
1482
+
1483
+ let field = argDef.data.link;
1484
+
1485
+ if (valueRequired === true) {
1486
+ field += '!';
1487
+ }
1488
+
1489
+ if (array) {
1490
+ field = `[${field}]`;
1491
+
1492
+ if (arrayRequired === true) {
1493
+ field += '!';
1494
+ }
1495
+ }
1496
+
1497
+ argDefinitions.push(`${argName}: ${field}`);
1466
1498
  } else {
1467
1499
  throw new Error(
1468
1500
  `Unsupported reference type '${refType.type}' for argument '${argName}' in '${operationName}'. ` +