SerializerFileSystem: check for function name uniqueness across project

This commit is contained in:
ac360 2016-02-20 09:16:36 -08:00
parent 80d47ac525
commit 96c59ee22d

View File

@ -249,9 +249,13 @@ class SerializerFileSystem {
return func.load()
.then(function(instance) {
if (component.functions[instance.name]) {
// Check for function name uniqueness across project
let components = component.getProject().getAllComponents();
components.forEach(function(c) {
if (c.functions[instance.name]) {
throw new SError(`Function name is already taken in project: ${instance.name} Function names must be unique across a project as of Serverless v0.5`);
}
}
});
component.functions[instance.name] = instance;
});