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