File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
integrations/openapi/src/contentSources Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @gitbook/integration-openapi ' : patch
3
+ ---
4
+
5
+ Improve spec not found error message
Original file line number Diff line number Diff line change 7
7
} from '@gitbook/runtime' ;
8
8
import { assertNever } from '../utils' ;
9
9
import type { OpenAPIRuntimeContext } from '../types' ;
10
- import { getLatestOpenAPISpecContent } from '../parser/spec' ;
10
+ import { getLatestOpenAPISpecContent , type OpenAPISpecContent } from '../parser/spec' ;
11
11
import { getRevisionFromSpec } from '../parser/revision' ;
12
12
import { getOpenAPIPageDocument } from '../parser/page' ;
13
13
import { getModelsDocument } from '../parser/models' ;
@@ -96,7 +96,7 @@ export const generateContentSource = createContentSource<
96
96
async function getOpenAPISpecFromDependencies (
97
97
dependencies : ContentSourceDependenciesValueFromRef < OpenAPIContentSource [ 'dependencies' ] > ,
98
98
ctx : OpenAPIRuntimeContext ,
99
- ) {
99
+ ) : Promise < OpenAPISpecContent > {
100
100
const { api } = ctx ;
101
101
const { installation } = ctx . environment ;
102
102
const specValue = dependencies . spec . value ;
@@ -106,7 +106,7 @@ async function getOpenAPISpecFromDependencies(
106
106
}
107
107
108
108
if ( specValue ?. object !== 'openapi-spec' ) {
109
- throw new ExposableError ( 'Invalid spec' ) ;
109
+ throw new ExposableError ( 'OpenAPI specification not found' , 404 ) ;
110
110
}
111
111
112
112
return getLatestOpenAPISpecContent ( {
You can’t perform that action at this time.
0 commit comments