File tree Expand file tree Collapse file tree 2 files changed +9
-15
lines changed
packages/web/src/app/api/(server)/openapi.json Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,9 @@ RUN chown -R sourcebot:sourcebot /app
220220# Copy zoekt proto files (needed for gRPC client at runtime)
221221COPY --chown=sourcebot:sourcebot vendor/zoekt/grpc/protos /app/vendor/zoekt/grpc/protos
222222
223+ # Copy OpenAPI docs
224+ COPY --chown=sourcebot:sourcebot docs/api-reference/sourcebot-public.openapi.json /app/docs/api-reference/sourcebot-public.openapi.json
225+
223226# Copy all of the things
224227COPY --chown=sourcebot:sourcebot --from=web-builder /app/packages/web/public ./packages/web/public
225228COPY --chown=sourcebot:sourcebot --from=web-builder /app/packages/web/.next/standalone ./
Original file line number Diff line number Diff line change @@ -4,24 +4,15 @@ import { apiHandler } from '@/lib/apiHandler';
44
55export const dynamic = 'force-dynamic' ;
66
7- const openApiPathCandidates = [
8- path . resolve ( process . cwd ( ) , 'docs/api-reference/sourcebot-public.openapi.json' ) ,
9- path . resolve ( process . cwd ( ) , '../docs/api-reference/sourcebot-public.openapi.json' ) ,
10- path . resolve ( process . cwd ( ) , '../../docs/api-reference/sourcebot-public.openapi.json' ) ,
11- ] ;
12-
137async function loadOpenApiDocument ( ) {
14- for ( const candidate of openApiPathCandidates ) {
15- try {
16- return JSON . parse ( await fs . readFile ( candidate , 'utf8' ) ) ;
17- } catch ( error ) {
18- if ( ( error as NodeJS . ErrnoException ) . code !== 'ENOENT' ) {
19- throw error ;
20- }
8+ const openApiPath = path . resolve ( process . cwd ( ) , '../../docs/api-reference/sourcebot-public.openapi.json' ) ;
9+ try {
10+ return JSON . parse ( await fs . readFile ( openApiPath , 'utf8' ) ) ;
11+ } catch ( error ) {
12+ if ( ( error as NodeJS . ErrnoException ) . code !== 'ENOENT' ) {
13+ throw error ;
2114 }
2215 }
23-
24- throw new Error ( 'OpenAPI spec file not found' ) ;
2516}
2617
2718export const GET = apiHandler ( async ( ) => {
You can’t perform that action at this time.
0 commit comments