You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's how I got around the issue. I'm now rendering swagger-ui (moved to the native js library) in an isolated <iframe /> with a Blob URL. I'm getting the scripts from the CDN. I guess this gives me lazy loading for free 🤷🏽♂️.
import{ContentHeightContainer}from"@/components/layout-right-drawer";import{EditorInputProps}from"@/components/module-api-editor/types";import{useEffect,useRef}from"react";exportfunctionVisualPreviewOpenAPI(props: EditorInputProps){constiframeRef=useRef<HTMLIFrameElement>(null);useEffect(()=>{constiframe=iframeRef.current;if(!iframe)return;// Create the HTML contentconsthtml=` <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.17.14/swagger-ui.css"> <base href="${window.location.origin}" /> </head> <body> <div id="swagger-ui"></div> <script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.11.0/swagger-ui-bundle.js"></script> <script> window.onload = function() { const ui = SwaggerUIBundle({ spec: ${JSON.stringify(props.value.data)}, dom_id: '#swagger-ui', presets: [ SwaggerUIBundle.presets.apis, SwaggerUIBundle.SwaggerUIStandalonePreset ], layout: "BaseLayout", deepLinking: false, }); } </script> </body> </html> `;// Create a blob URL from the HTML contentconstblob=newBlob([html],{type: "text/html"});constblobUrl=URL.createObjectURL(blob);// Set the iframe src to the blob URLiframe.src=blobUrl;// Clean up the blob URL when the component unmountsreturn()=>{URL.revokeObjectURL(blobUrl);};},[props.value.data]);return(<ContentHeightContainer><iframeref={iframeRef}style={{width: "100%",height: "100%",border: "none",minHeight: "500px",}}sandbox="allow-scripts"/></ContentHeightContainer>);}
General:
Content & configuration
Whenever I try to resolve a component schema:
Describe the bug you're encountering
In my current app, swagger-ui it not able to resolve references whenever an escape sequence is present in my apps query parameters (not in the spec).
This is a dublicate of #9304 . The fix in the issue does not seem to work. Api-dom is locked on version
1.0.0-alpha.10
(after the supposed fix)To reproduce...
?activeElement=%7B"type"%3A"create_client"%7D
What I have tried
The text was updated successfully, but these errors were encountered: