@@ -107,6 +107,7 @@ const checkPlugins = (pluginsNode: parse.PropertyNode | undefined, diagnostics:
107
107
warnOnReporterPosition ( pluginNodes , diagnostics ) ;
108
108
validatePluginConfigurations ( pluginNodes , diagnostics , documentNode ) ;
109
109
checkForSummaryPluginWithoutReporter ( pluginNodes , diagnostics ) ;
110
+ checkAPICOnboardingPluginAfterOpenApiSpecGeneratorPlugin ( pluginNodes , diagnostics ) ;
110
111
}
111
112
} ;
112
113
@@ -341,4 +342,47 @@ function checkForSummaryPluginWithoutReporter(pluginNodes: parse.ObjectNode[], d
341
342
) ;
342
343
}
343
344
}
345
+ }
346
+
347
+ function checkAPICOnboardingPluginAfterOpenApiSpecGeneratorPlugin ( pluginNodes : parse . ObjectNode [ ] , diagnostics : vscode . Diagnostic [ ] ) {
348
+ const openApiSpecGeneratorPluginIndex = pluginNodes . findIndex ( ( pluginNode : parse . ObjectNode ) => {
349
+ const pluginNameNode = getASTNode (
350
+ pluginNode . children ,
351
+ 'Identifier' ,
352
+ 'name'
353
+ ) ;
354
+ const pluginName = ( pluginNameNode ?. value as parse . LiteralNode )
355
+ . value as string ;
356
+ const enabledNode = getASTNode (
357
+ pluginNode . children ,
358
+ 'Identifier' ,
359
+ 'enabled'
360
+ ) ;
361
+ const isEnabled = ( enabledNode ?. value as parse . LiteralNode )
362
+ . value as boolean ;
363
+ return pluginName === 'OpenApiSpecGeneratorPlugin' && isEnabled ;
364
+ }
365
+ ) ;
366
+ if ( openApiSpecGeneratorPluginIndex !== - 1 ) {
367
+ const apiCenterOnboardingPluginIndex = pluginNodes . findIndex ( ( pluginNode : parse . ObjectNode ) => {
368
+ const pluginNameNode = getASTNode (
369
+ pluginNode . children ,
370
+ 'Identifier' ,
371
+ 'name'
372
+ ) ;
373
+ const pluginName = ( pluginNameNode ?. value as parse . LiteralNode )
374
+ . value as string ;
375
+ return pluginName === 'ApiCenterOnboardingPlugin' ;
376
+ }
377
+ ) ;
378
+ if ( apiCenterOnboardingPluginIndex !== - 1 && apiCenterOnboardingPluginIndex < openApiSpecGeneratorPluginIndex ) {
379
+ diagnostics . push (
380
+ new vscode . Diagnostic (
381
+ getRangeFromASTNode ( pluginNodes [ openApiSpecGeneratorPluginIndex ] ) ,
382
+ 'OpenApiSpecGeneratorPlugin should be placed before ApiCenterOnboardingPlugin.' ,
383
+ vscode . DiagnosticSeverity . Warning
384
+ )
385
+ ) ;
386
+ }
387
+ }
344
388
}
0 commit comments