Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
await validateSchema(context);
const backendPath = await context.amplify.pathManager.getBackendDirPath();
const apiResourcePath = path.join(backendPath, 'api', apiResource.resourceName);
const directiveDefinitions = await context.amplify.executeProviderUtils(context, 'awscloudformation', 'getTransformerDirectives', {
resourceDir: apiResourcePath,
});
const schemaContent = loadSchema(apiResourcePath);
const outputPath = path.join(projectRoot, getModelOutputPath(context));
const schema = parse(schemaContent);
const projectConfig = context.amplify.getProjectConfig();
const appsyncLocalConfig = await appSyncDataStoreCodeGen.preset.buildGeneratesSection({
baseOutputDir: outputPath,
schema,
config: {
target: projectConfig.frontend,
directives: directiveDefinitions,
},
});
const codeGenPromises = appsyncLocalConfig.map(cfg => {
return gqlCodeGen.codegen({
...cfg,
plugins: [
{
appSyncLocalCodeGen: {},
},
],