@@ -64,13 +64,14 @@ public WorkflowValidator setSource(String source) {
6464 @ Override
6565 public Collection <ValidationError > validate () {
6666 validationErrors .clear ();
67- if (workflow == null && schemaValidationEnabled && source != null ) {
67+ if (workflow == null ) {
6868 try {
69-
70- JsonSchemaFactory .getInstance (VersionFlag .V202012 )
71- .getSchema (workflowSchema )
72- .validate (Utils .getNode (source ))
73- .forEach (m -> addValidationError (m .getMessage (), ValidationError .SCHEMA_VALIDATION ));
69+ if (schemaValidationEnabled && source != null ) {
70+ JsonSchemaFactory .getInstance (VersionFlag .V7 )
71+ .getSchema (workflowSchema )
72+ .validate (Utils .getNode (source ))
73+ .forEach (m -> addValidationError (m .getMessage (), ValidationError .SCHEMA_VALIDATION ));
74+ }
7475 } catch (IOException e ) {
7576 logger .error ("Unexpected error during validation" , e );
7677 }
@@ -163,17 +164,6 @@ public Collection<ValidationError> validate() {
163164 }
164165
165166 if (action .getEventRef () != null ) {
166- if (action .getEventRef ().getTriggerEventRef ().isEmpty ()) {
167- addValidationError (
168- "Operation State action trigger eventRef does not reference an existing workflow event definition" ,
169- ValidationError .WORKFLOW_VALIDATION );
170- }
171-
172- if (action .getEventRef ().getResultEventRef ().isEmpty ()) {
173- addValidationError (
174- "Operation State action results eventRef does not reference an existing workflow event definition" ,
175- ValidationError .WORKFLOW_VALIDATION );
176- }
177167
178168 if (!haveEventsDefinition (
179169 action .getEventRef ().getTriggerEventRef (), events )) {
@@ -357,22 +347,19 @@ private boolean haveFunctionDefinition(String functionName, List<FunctionDefinit
357347 }
358348
359349 private boolean haveEventsDefinition (String eventName , List <EventDefinition > events ) {
350+ if (eventName == null ) {
351+ return true ;
352+ }
360353 if (events != null ) {
361354 EventDefinition eve =
362355 events .stream ().filter (e -> e .getName ().equals (eventName )).findFirst ().orElse (null );
363-
364356 return eve == null ? false : true ;
365357 } else {
366358 return false ;
367359 }
368360 }
369361
370- private static final Set <String > skipMessages =
371- Set .of (
372- "$.start: string found, object expected" ,
373- "$.functions: array found, object expected" ,
374- "$.events: array found, object expected" ,
375- "$.retries: array found, object expected" );
362+ private static final Set <String > skipMessages = Set .of ("$.start: string found, object expected" );
376363
377364 private void addValidationError (String message , String type ) {
378365 if (skipMessages .contains (message )) {
@@ -385,7 +372,6 @@ private void addValidationError(String message, String type) {
385372 }
386373
387374 private class Validation {
388-
389375 final Set <String > states = new HashSet <>();
390376 Integer endStates = 0 ;
391377
0 commit comments