Skip to content

Commit

Permalink
Fix e2e tests for pluralization (#7590)
Browse files Browse the repository at this point in the history
Currently, we’re testing the iterative update by renaming the intial Todo model and updating it to Todos. Previously, this created a resolver called listTodoss (because it incorrectly blindly appended s). With the pluralization fix, it creates a resolver called listTodos - which unfortunately already exists and therefore appsync throws a Only one resolver is allowed per field error (aws/aws-appsync-community#128)
  • Loading branch information
johnpc committed Jun 24, 2021
1 parent a6ddc41 commit 9f5873f
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -5,8 +5,7 @@ const path = require('path');
const { RelationalDBSchemaTransformer } = require('graphql-relational-schema-transformer');
const { RelationalDBTemplateGenerator, AuroraServerlessMySQLDatabaseReader } = require('graphql-relational-schema-transformer');
const { mergeTypeDefs } = require('@graphql-tools/merge');
const { ResourceDoesNotExistError, exitOnNextTick } = require('amplify-cli-core');

const { FeatureFlags, ResourceDoesNotExistError, exitOnNextTick } = require('amplify-cli-core');
const subcommand = 'add-graphql-datasource';
const categories = 'categories';
const category = 'api';
Expand Down Expand Up @@ -143,7 +142,11 @@ module.exports = {
context[rdsResourceName] = resourceName;
context[rdsDatasource] = datasource;
let template = templateGenerator.createTemplate(context);
template = templateGenerator.addRelationalResolvers(template, resolversDir);
template = templateGenerator.addRelationalResolvers(
template,
resolversDir,
FeatureFlags.getBoolean('graphqltransformer.improvePluralization'),
);
const cfn = templateGenerator.printCloudformationTemplate(template);

/**
Expand Down

0 comments on commit 9f5873f

Please sign in to comment.