Skip to content

Commit

Permalink
fix(api): add auto generated comment to the generated typescript data…
Browse files Browse the repository at this point in the history
… schema file
  • Loading branch information
sundersc committed Apr 18, 2024
1 parent a5a233c commit 650308a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`Type name conversions basic models should generate correct typescript data schema 1`] = `
"/* eslint-disable */
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
import { a } from \\"@aws-amplify/data-schema\\";
export const schema = a.schema({
Expand All @@ -23,6 +24,7 @@ export const schema = a.schema({

exports[`Type name conversions check all valid datatypes 1`] = `
"/* eslint-disable */
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
import { a } from \\"@aws-amplify/data-schema\\";
export const schema = a.schema({
Expand Down Expand Up @@ -52,6 +54,7 @@ export const schema = a.schema({

exports[`Type name conversions generates enum imports correctly 1`] = `
"/* eslint-disable */
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
import { a } from \\"@aws-amplify/data-schema\\";
export const schema = a.schema({
Expand All @@ -71,6 +74,7 @@ export const schema = a.schema({

exports[`Type name conversions postgres schema with database config secret and vpc should generate typescript data schema with configure 1`] = `
"/* eslint-disable */
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
import { a } from \\"@aws-amplify/data-schema\\";
import { configure } from \\"@aws-amplify/data-schema/internals\\";
import { secret } from \\"@aws-amplify/backend\\";
Expand Down Expand Up @@ -106,6 +110,7 @@ export const schema = configure({

exports[`Type name conversions schema with database config secret and vpc should generate typescript data schema with configure 1`] = `
"/* eslint-disable */
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
import { a } from \\"@aws-amplify/data-schema\\";
import { configure } from \\"@aws-amplify/data-schema/internals\\";
import { secret } from \\"@aws-amplify/backend\\";
Expand Down Expand Up @@ -157,6 +162,7 @@ export const schema = configure({

exports[`Type name conversions schema with database config without vpc should generate typescript data schema with configure 1`] = `
"/* eslint-disable */
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
import { a } from \\"@aws-amplify/data-schema\\";
import { configure } from \\"@aws-amplify/data-schema/internals\\";
import { secret } from \\"@aws-amplify/backend\\";
Expand Down Expand Up @@ -186,6 +192,7 @@ export const schema = configure({

exports[`Type name conversions ts schema generator should invoke generate schema 1`] = `
"/* eslint-disable */
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
import { a } from \\"@aws-amplify/data-schema\\";
import { configure } from \\"@aws-amplify/data-schema/internals\\";
import { secret } from \\"@aws-amplify/backend\\";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,14 @@ export const createImportExpression = (containsSecretName: boolean): ts.NodeArra
true,
);

const importExpressions = [importStatementWithEslintDisabled];
const importStatementWithAutoGeneratedComment = ts.addSyntheticLeadingComment(
importStatementWithEslintDisabled,
ts.SyntaxKind.MultiLineCommentTrivia,
' THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. ',
true,
);

const importExpressions = [importStatementWithAutoGeneratedComment];
if (containsSecretName) {
importExpressions.push(internalsConfigureImportStatement, secretImportStatement);
}
Expand Down

0 comments on commit 650308a

Please sign in to comment.