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' ;
219
320export class ValidationError {
421 readonly message : string ;
5-
6- constructor ( readonly error : ErrorObject ) {
22+
23+ constructor ( readonly error : DefinedError ) {
724 this . message = `invalid: ${ error . instancePath } | ${ error . schemaPath } | ${ error . message } ` ;
825 }
926}
Original file line number Diff line number Diff line change 1515 *
1616 */
1717
18- import { ValidateFunction } from 'ajv' ;
18+ import { ValidateFunction , DefinedError } from 'ajv' ;
1919import { Specification } from './definitions' ;
2020import { validators } from './validators' ;
2121import { ValidationError } from './validation-error' ;
@@ -35,7 +35,7 @@ export class WorkflowValidator {
3535 const validateFn = validators . get ( 'Workflow' ) as ValidateFunction < Specification . Workflow > ;
3636 this . isValid = validateFn ( this . workflow ) ;
3737 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 ) ) ;
3939 }
4040 }
4141}
You can’t perform that action at this time.
0 commit comments