Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: port sanity check to transformer V2 (#8563)
* fix: run schema sanity check after V2 transformer * chore: fit and finish * fix: placeholder resource name * chore: address PR comments
- Loading branch information
1 parent
d932f7b
commit 840ce0f
Showing
3 changed files
with
55 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/amplify-provider-awscloudformation/src/graphql-transformer/sanity-check.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { DiffRule, ProjectRule, sanityCheckProject } from 'graphql-transformer-core'; | ||
|
||
export type SanityCheckRules = { | ||
diffRules: DiffRule[]; | ||
projectRules: ProjectRule[]; | ||
}; | ||
|
||
export class GraphQLSanityCheck { | ||
constructor( | ||
private readonly rules: SanityCheckRules, | ||
private readonly rootStackFileName: string, | ||
private readonly currentCloudBackendDir: string, | ||
private readonly localStateDir: string, | ||
) {} | ||
|
||
validate = async () => { | ||
await sanityCheckProject( | ||
this.currentCloudBackendDir, | ||
this.localStateDir, | ||
this.rootStackFileName, | ||
this.rules.diffRules, | ||
this.rules.projectRules, | ||
); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters