diff --git a/src/resources/Schema.ts b/src/resources/Schema.ts index 916c3fc3..3bfb8af0 100644 --- a/src/resources/Schema.ts +++ b/src/resources/Schema.ts @@ -58,13 +58,11 @@ export class Schema { } generateSchema() { - const schemaFiles = flatten(globby.sync(this.schemas)); + const cwd = this.api.plugin.serverless.config.servicePath; + const schemaFiles = flatten(globby.sync(this.schemas, { cwd })); const schemas = schemaFiles.map((file) => { - return fs.readFileSync( - path.join(this.api.plugin.serverless.config.servicePath, file), - 'utf8', - ); + return fs.readFileSync(path.join(cwd, file), 'utf8'); }); this.valdiateSchema(AWS_TYPES + '\n' + schemas.join('\n'));