diff --git a/apps/swagger/lib/snippets.ts b/apps/swagger/lib/snippets.ts index fa4d5d4c55..b1ec3fc305 100644 --- a/apps/swagger/lib/snippets.ts +++ b/apps/swagger/lib/snippets.ts @@ -77,7 +77,7 @@ export const SnippedGenerator = { // method, // targets // // Since I don't know why hostname was undefinedundefined, I harcoded it here - // ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + // ).snippets[0].content; // } catch (err) { // // set to error in case it happens the npm package has some flaws // snippet = JSON.stringify(snippet); @@ -104,12 +104,8 @@ export const SnippedGenerator = { let snippet; try { // set request snippet content - snippet = OpenAPISnippet.getEndpointSnippets( - spec, - path, - method, - targets - ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + snippet = OpenAPISnippet.getEndpointSnippets(spec, path, method, targets).snippets[0] + .content; } catch (err) { // set to error in case it happens the npm package has some flaws snippet = JSON.stringify(snippet); @@ -136,12 +132,8 @@ export const SnippedGenerator = { let snippet; try { // set request snippet content - snippet = OpenAPISnippet.getEndpointSnippets( - spec, - path, - method, - targets - ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + snippet = OpenAPISnippet.getEndpointSnippets(spec, path, method, targets).snippets[0] + .content; } catch (err) { // set to error in case it happens the npm package has some flaws snippet = JSON.stringify(snippet); @@ -168,12 +160,8 @@ export const SnippedGenerator = { let snippet; try { // set request snippet content - snippet = OpenAPISnippet.getEndpointSnippets( - spec, - path, - method, - targets - ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + snippet = OpenAPISnippet.getEndpointSnippets(spec, path, method, targets).snippets[0] + .content; } catch (err) { // set to error in case it happens the npm package has some flaws snippet = JSON.stringify(snippet); @@ -200,12 +188,8 @@ export const SnippedGenerator = { let snippet; try { // set request snippet content - snippet = OpenAPISnippet.getEndpointSnippets( - spec, - path, - method, - targets - ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + snippet = OpenAPISnippet.getEndpointSnippets(spec, path, method, targets).snippets[0] + .content; } catch (err) { // set to error in case it happens the npm package has some flaws snippet = JSON.stringify(snippet); @@ -237,7 +221,7 @@ export const SnippedGenerator = { // path, // method, // targets - // ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + // ).snippets[0].content; // } catch (err) { // // set to error in case it happens the npm package has some flaws // snippet = JSON.stringify(snippet); @@ -269,7 +253,7 @@ export const SnippedGenerator = { // path, // method, // targets - // ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + // ).snippets[0].content; // } catch (err) { // // set to error in case it happens the npm package has some flaws // snippet = JSON.stringify(snippet); @@ -296,12 +280,8 @@ export const SnippedGenerator = { let snippet; try { // set request snippet content - snippet = OpenAPISnippet.getEndpointSnippets( - spec, - path, - method, - targets - ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + snippet = OpenAPISnippet.getEndpointSnippets(spec, path, method, targets).snippets[0] + .content; } catch (err) { // set to error in case it happens the npm package has some flaws snippet = JSON.stringify(snippet); @@ -328,12 +308,8 @@ export const SnippedGenerator = { let snippet; try { // set request snippet content - snippet = OpenAPISnippet.getEndpointSnippets( - spec, - path, - method, - targets - ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + snippet = OpenAPISnippet.getEndpointSnippets(spec, path, method, targets).snippets[0] + .content; } catch (err) { // set to error in case it happens the npm package has some flaws snippet = JSON.stringify(snippet); @@ -360,12 +336,8 @@ export const SnippedGenerator = { let snippet; try { // set request snippet content - snippet = OpenAPISnippet.getEndpointSnippets( - spec, - path, - method, - targets - ).snippets[0].content.replaceAll("undefinedundefined", "https://api.cal.com"); + snippet = OpenAPISnippet.getEndpointSnippets(spec, path, method, targets).snippets[0] + .content; } catch (err) { // set to error in case it happens the npm package has some flaws snippet = JSON.stringify(snippet); diff --git a/apps/swagger/package.json b/apps/swagger/package.json index b68bafd903..129452adfb 100644 --- a/apps/swagger/package.json +++ b/apps/swagger/package.json @@ -10,14 +10,14 @@ "dependencies": { "highlight.js": "^11.5.1", "isarray": "2.0.5", - "next": "12.1.4", + "next": "12.1.5", "openapi-snippet": "^0.13.0", "react": "17.0.2", "react-dom": "17.0.2", - "swagger-ui-react": "4.8.1" + "swagger-ui-react": "4.10.3" }, "devDependencies": { - "@types/node": "16.11.26", + "@types/node": "17.0.27", "@types/react": "17.0.43", "@types/react-dom": "17.0.14", "typescript": "4.6.3" diff --git a/apps/swagger/pages/index.tsx b/apps/swagger/pages/index.tsx index 1baa91d5ed..32c2442f6b 100644 --- a/apps/swagger/pages/index.tsx +++ b/apps/swagger/pages/index.tsx @@ -1,7 +1,11 @@ -import SwaggerUI from "swagger-ui-react"; +// import SwaggerUI from "swagger-ui-react"; +import dynamic from "next/dynamic"; +import { ComponentType } from "react"; import { SnippedGenerator, requestSnippets } from "@lib/snippets"; +const SwaggerUI: any = dynamic(() => import("swagger-ui-react"), { ssr: false }); + export default function APIDocs() { return (