@aws-amplify/data-schema
Advanced tools
Comparing version 0.14.4 to 0.14.5
@@ -26,2 +26,3 @@ "use strict"; | ||
transform() { | ||
validateDuplicateTypeNames(schemas); | ||
const baseDefinition = { | ||
@@ -57,1 +58,17 @@ functionSlots: [], | ||
} | ||
function validateDuplicateTypeNames(schemas) { | ||
const allSchemaKeys = schemas.flatMap((s) => Object.keys(s.data.types)); | ||
const keySet = new Set(); | ||
const duplicateKeySet = new Set(); | ||
allSchemaKeys.forEach((key) => { | ||
if (keySet.has(key)) { | ||
duplicateKeySet.add(key); | ||
} | ||
else { | ||
keySet.add(key); | ||
} | ||
}); | ||
if (duplicateKeySet.size > 0) { | ||
throw new Error(`The schemas you are attempting to combine have a name collision. Please remove or rename ${Array.from(duplicateKeySet).join(', ')}.`); | ||
} | ||
} |
{ | ||
"name": "@aws-amplify/data-schema", | ||
"version": "0.14.4", | ||
"version": "0.14.5", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
654922
4086