Compare commits

...

1 Commits

3 changed files with 25 additions and 49 deletions

View File

@ -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);

View File

@ -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"

View File

@ -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 (
<SwaggerUI