File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
packages/openapi-parser/src Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @gitbook/openapi-parser ' : patch
3
+ ---
4
+
5
+ Pass scalar's errors through OpenAPIParseError
Original file line number Diff line number Diff line change
1
+ import type { ErrorObject } from '@scalar/openapi-parser' ;
2
+
1
3
type OpenAPIParseErrorCode =
2
4
| 'invalid'
3
5
| 'parse-v2-in-v3'
@@ -12,17 +14,19 @@ export class OpenAPIParseError extends Error {
12
14
public override name = 'OpenAPIParseError' ;
13
15
public code : OpenAPIParseErrorCode ;
14
16
public rootURL : string | null ;
15
-
17
+ public errors : ErrorObject [ ] | undefined ;
16
18
constructor (
17
19
message : string ,
18
20
options : {
19
21
code : OpenAPIParseErrorCode ;
20
22
rootURL ?: string | null ;
21
23
cause ?: Error ;
24
+ errors ?: ErrorObject [ ] | undefined ;
22
25
}
23
26
) {
24
27
super ( message , { cause : options . cause } ) ;
25
28
this . code = options . code ;
26
29
this . rootURL = options . rootURL ?? null ;
30
+ this . errors = options . errors ;
27
31
}
28
32
}
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ async function untrustedValidate(input: ValidateOpenAPIV3Input) {
40
40
throw new OpenAPIParseError ( 'Invalid OpenAPI document' , {
41
41
code : 'invalid' ,
42
42
rootURL,
43
+ errors : result . errors ,
43
44
} ) ;
44
45
}
45
46
You can’t perform that action at this time.
0 commit comments