Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't migrate AppSync auth related directives #8661

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -256,25 +256,4 @@ describe('Schema migration tests', () => {
migrateAndValidate(schema);
}).toThrow('Unknown directive "versioned".');
});

// TODO(cjihrig): This test is currently failing.
// it('AppSync directives are not migrated', () => {
// const schema1 = `
// type Todo @model @aws_api_key {
// id: ID!
// }`;

// expect(() => {
// migrateAndValidate(schema1);
// }).toThrow('Unknown directive "aws_api_key".');

// const schema2 = `
// type Todo @model @aws_iam {
// id: ID!
// }`;

// expect(() => {
// migrateAndValidate(schema2);
// }).toThrow('Unknown directive "aws_iam".');
// });
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,21 @@ test('deprecated @connection parameterization fails gracefully', async () => {
]
`);
});

test('AppSync auth directives are not migrated', async () => {
const denylist = ['aws_api_key', 'aws_iam', 'aws_oidc', 'aws_cognito_user_pools', 'aws_auth'];

for (const directive of denylist) {
const schema = `
type Todo @model @${directive} {
id: ID!
}`;
const result = await detectUnsupportedDirectives(schema);

expect(result).toMatchInlineSnapshot(`
Array [
"${directive}",
]
`);
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ export async function detectUnsupportedDirectives(schema: string): Promise<Array
'model',
'function',
'predictions',
'aws_api_key',
'aws_iam',
'aws_oidc',
'aws_cognito_user_pools',
'aws_auth',
'aws_subscribe',
]);
const directiveMap: any = collectDirectivesByTypeNames(schema).types;
Expand Down