How to use amplify-codegen-appsync-model-plugin - 1 common examples

To help you get started, we’ve selected a few amplify-codegen-appsync-model-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-cli / packages / amplify-codegen / src / commands / models.js View on Github external
}

  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: {},
        },
      ],

amplify-codegen-appsync-model-plugin

Apache-2.0
Latest version published 3 years ago

Package Health Score

72 / 100
Full package analysis

Popular amplify-codegen-appsync-model-plugin functions