File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 1
- import { ErrorObject } from 'ajv' ;
1
+ /*
2
+ * Copyright 2021-Present The Serverless Workflow Specification Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * oUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ import { DefinedError } from 'ajv' ;
2
19
3
20
export class ValidationError {
4
21
readonly message : string ;
5
-
6
- constructor ( readonly error : ErrorObject ) {
22
+
23
+ constructor ( readonly error : DefinedError ) {
7
24
this . message = `invalid: ${ error . instancePath } | ${ error . schemaPath } | ${ error . message } ` ;
8
25
}
9
26
}
Original file line number Diff line number Diff line change 15
15
*
16
16
*/
17
17
18
- import { ValidateFunction } from 'ajv' ;
18
+ import { ValidateFunction , DefinedError } from 'ajv' ;
19
19
import { Specification } from './definitions' ;
20
20
import { validators } from './validators' ;
21
21
import { ValidationError } from './validation-error' ;
@@ -35,7 +35,7 @@ export class WorkflowValidator {
35
35
const validateFn = validators . get ( 'Workflow' ) as ValidateFunction < Specification . Workflow > ;
36
36
this . isValid = validateFn ( this . workflow ) ;
37
37
if ( validateFn . errors ) {
38
- this . errors = validateFn . errors . map ( ( error ) => new ValidationError ( error ) ) ;
38
+ this . errors = validateFn . errors . map ( ( error ) => new ValidationError ( error as DefinedError ) ) ;
39
39
}
40
40
}
41
41
}
You can’t perform that action at this time.
0 commit comments