@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.
@@ -952,8 +952,19 @@ function generateInputTypes(operationName, args, getRefType) {
952
952
  if (isRefField(argDef)) {
953
953
  const refType = getRefType(argDef.data.link, operationName);
954
954
  if (refType.type === 'CustomType') {
955
+ const { valueRequired, array, arrayRequired } = argDef.data;
955
956
  const inputTypeName = `${argDef.data.link}Input`;
956
- argDefinitions.push(`${argName}: ${inputTypeName}`);
957
+ let field = inputTypeName;
958
+ if (valueRequired === true) {
959
+ field += '!';
960
+ }
961
+ if (array) {
962
+ field = `[${field}]`;
963
+ if (arrayRequired === true) {
964
+ field += '!';
965
+ }
966
+ }
967
+ argDefinitions.push(`${argName}: ${field}`);
957
968
  // Process the input type if it hasn't been processed yet
958
969
  if (!processedTypes.has(inputTypeName)) {
959
970
  processedTypes.add(inputTypeName);
@@ -965,7 +976,18 @@ function generateInputTypes(operationName, args, getRefType) {
965
976
  }
966
977
  }
967
978
  else if (refType.type === 'Enum') {
968
- argDefinitions.push(`${argName}: ${argDef.data.link}`);
979
+ const { valueRequired, array, arrayRequired } = argDef.data;
980
+ let field = argDef.data.link;
981
+ if (valueRequired === true) {
982
+ field += '!';
983
+ }
984
+ if (array) {
985
+ field = `[${field}]`;
986
+ if (arrayRequired === true) {
987
+ field += '!';
988
+ }
989
+ }
990
+ argDefinitions.push(`${argName}: ${field}`);
969
991
  }
970
992
  else {
971
993
  throw new Error(`Unsupported reference type '${refType.type}' for argument '${argName}' in '${operationName}'. ` +