Commit 0fbe6e26 authored by Dimitrios Gogos's avatar Dimitrios Gogos
Browse files

feat: add request interceptor to SwaggerUI for OEG proxy handling

parent 49d0b2dd
Loading
Loading
Loading
Loading
Loading
+10 −0
Changes for portal-gui/src/features/apis/api-details-page.tsx: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -358,6 +358,16 @@ export function ApiDetailsPage() {
                <div className="api-documentation overflow-hidden rounded-xl bg-card">
                  <SwaggerUI
                    url={oeg.jsonUrl}
                    requestInterceptor={(req) => {
                      const url = new URL(req.url, window.location.origin);
                      if (
                        url.origin === window.location.origin &&
                        !url.pathname.startsWith('/api/')
                      ) {
                        req.url = `/api/oeg${url.pathname}${url.search}`;
                      }
                      return req;
                    }}
                    docExpansion="list"
                    defaultModelsExpandDepth={-1}
                    defaultModelExpandDepth={-1}
+1 −0
Changes for portal-gui/src/types/swagger-ui-react.d.ts: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ declare module 'swagger-ui-react' {
  export interface SwaggerUIProps {
    spec?: unknown;
    url?: string;
    requestInterceptor?: (req: { url: string }) => { url: string };
    docExpansion?: 'list' | 'full' | 'none';
    defaultModelsExpandDepth?: number;
    defaultModelExpandDepth?: number;