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+
13type OpenAPIParseErrorCode =
24 | 'invalid'
35 | 'parse-v2-in-v3'
@@ -12,17 +14,19 @@ export class OpenAPIParseError extends Error {
1214 public override name = 'OpenAPIParseError' ;
1315 public code : OpenAPIParseErrorCode ;
1416 public rootURL : string | null ;
15-
17+ public errors : ErrorObject [ ] | undefined ;
1618 constructor (
1719 message : string ,
1820 options : {
1921 code : OpenAPIParseErrorCode ;
2022 rootURL ?: string | null ;
2123 cause ?: Error ;
24+ errors ?: ErrorObject [ ] | undefined ;
2225 }
2326 ) {
2427 super ( message , { cause : options . cause } ) ;
2528 this . code = options . code ;
2629 this . rootURL = options . rootURL ?? null ;
30+ this . errors = options . errors ;
2731 }
2832}
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ async function untrustedValidate(input: ValidateOpenAPIV3Input) {
4040 throw new OpenAPIParseError ( 'Invalid OpenAPI document' , {
4141 code : 'invalid' ,
4242 rootURL,
43+ errors : result . errors ,
4344 } ) ;
4445 }
4546
You can’t perform that action at this time.
0 commit comments