@@ -31,15 +31,16 @@ export async function executePlugin(options: ExecutePluginOptions, plugin: Codeg
31
31
}
32
32
33
33
const outputSchema : GraphQLSchema = buildASTSchema ( options . schema ) ;
34
+ const documents = options . documents || [ ] ;
34
35
35
- if ( outputSchema && options . documents . length > 0 ) {
36
- const errors = validateGraphQlDocuments ( outputSchema , options . documents ) ;
36
+ if ( outputSchema && documents . length > 0 ) {
37
+ const errors = validateGraphQlDocuments ( outputSchema , documents ) ;
37
38
checkValidationErrors ( errors ) ;
38
39
}
39
40
40
41
if ( plugin . validate && typeof plugin . validate === 'function' ) {
41
42
try {
42
- await plugin . validate ( outputSchema , options . documents , options . config , options . outputFilename , options . allPlugins ) ;
43
+ await plugin . validate ( outputSchema , documents , options . config , options . outputFilename , options . allPlugins ) ;
43
44
} catch ( e ) {
44
45
throw new DetailedError (
45
46
`Plugin "${ options . name } " validation failed:` ,
@@ -50,7 +51,7 @@ export async function executePlugin(options: ExecutePluginOptions, plugin: Codeg
50
51
}
51
52
}
52
53
53
- return plugin . plugin ( outputSchema , options . documents , options . config , {
54
+ return plugin . plugin ( outputSchema , documents , options . config , {
54
55
outputFile : options . outputFilename ,
55
56
allPlugins : options . allPlugins ,
56
57
} ) ;
0 commit comments