diff --git a/CHANGELOG.md b/CHANGELOG.md index b327c7b97..04a77375d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +## 3.0.0-beta.5 (Jan 18, 2024) + +High level enhancements + +- Add support for x-CodeSamples +- Add callbacks support +- Add markdown support to example/examples summary +- Remove deprecated node packages from generated snippets + +Other enhancements and bug fixes + +- Add support to x-codeSamples in v3 ([#701](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/701)) +- Add Callbacks Support to V3 ([#700](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/700)) +- Remove deprecated node packages ([#699](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/699)) +- Add markdown support to example summary ([#690](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/690)) + ## 3.0.0-beta.4 (Jan 5, 2024) High level enhancements diff --git a/demo/docs/customization/languagetabs.mdx b/demo/docs/customization/languagetabs.mdx index 0d9de3d36..b40c8cdca 100644 --- a/demo/docs/customization/languagetabs.mdx +++ b/demo/docs/customization/languagetabs.mdx @@ -15,7 +15,7 @@ The Docusaurus OpenAPI docs plugin comes with support for 8 languages which you | `curl` | bash | `curl`\* | | `python` | python | `requests`\*, `http.client` | | `go` | go | `native`\* | -| `nodejs` | javascript | `axios`\*, `native`, `requests`, `unirest` | +| `nodejs` | javascript | `axios`\*, `native` | | `ruby` | ruby | `net::http`\* | | `csharp` | csharp | `restsharp`\*, `httpclient` | | `php` | php | `curl`\*, `guzzle`, `pecl_http`, `http_request2` | diff --git a/demo/package.json b/demo/package.json index d5104b2ca..1e190a2ba 100644 --- a/demo/package.json +++ b/demo/package.json @@ -1,6 +1,6 @@ { "name": "demo", - "version": "3.0.0-beta.4", + "version": "3.0.0-beta.5", "private": true, "scripts": { "docusaurus": "docusaurus", @@ -25,8 +25,8 @@ "@docusaurus/plugin-google-gtag": "3.0.1", "@docusaurus/preset-classic": "3.0.1", "clsx": "^1.1.1", - "docusaurus-plugin-openapi-docs": "^3.0.0-beta.4", - "docusaurus-theme-openapi-docs": "^3.0.0-beta.4", + "docusaurus-plugin-openapi-docs": "^3.0.0-beta.5", + "docusaurus-theme-openapi-docs": "^3.0.0-beta.5", "prism-react-renderer": "^2.3.0", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/lerna.json b/lerna.json index 8544ebedf..0528a1880 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "3.0.0-beta.4", + "version": "3.0.0-beta.5", "npmClient": "yarn", "useWorkspaces": true } diff --git a/package.json b/package.json index 3541c3f59..aa9a789a1 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ }, "devDependencies": { "@babel/core": "^7.16.0", + "@eslint-community/eslint-utils": "^4.4.0", "@testing-library/cypress": "^8.0.1", "@types/jest": "^27.0.2", "@types/node": "^17.0.2", diff --git a/packages/docusaurus-plugin-openapi-docs/package.json b/packages/docusaurus-plugin-openapi-docs/package.json index 05076c4ee..8ac7e9725 100644 --- a/packages/docusaurus-plugin-openapi-docs/package.json +++ b/packages/docusaurus-plugin-openapi-docs/package.json @@ -1,7 +1,7 @@ { "name": "docusaurus-plugin-openapi-docs", "description": "OpenAPI plugin for Docusaurus.", - "version": "3.0.0-beta.4", + "version": "3.0.0-beta.5", "license": "MIT", "keywords": [ "openapi", diff --git a/packages/docusaurus-plugin-openapi-docs/src/markdown/createStatusCodes.ts b/packages/docusaurus-plugin-openapi-docs/src/markdown/createStatusCodes.ts index 13d7f0bc6..9ebeda225 100644 --- a/packages/docusaurus-plugin-openapi-docs/src/markdown/createStatusCodes.ts +++ b/packages/docusaurus-plugin-openapi-docs/src/markdown/createStatusCodes.ts @@ -127,7 +127,7 @@ export function createResponseExamples( value: `${exampleName}`, children: [ guard(exampleValue.summary, (summary) => [ - create("p", { + create("Markdown", { children: ` ${summary}`, }), ]), @@ -143,7 +143,7 @@ export function createResponseExamples( value: `${exampleName}`, children: [ guard(exampleValue.summary, (summary) => [ - create("p", { + create("Markdown", { children: ` ${summary}`, }), ]), @@ -171,7 +171,7 @@ export function createResponseExample(responseExample: any, mimeType: string) { value: `Example`, children: [ guard(responseExample.summary, (summary) => [ - create("p", { + create("Markdown", { children: ` ${summary}`, }), ]), @@ -187,7 +187,7 @@ export function createResponseExample(responseExample: any, mimeType: string) { value: `Example`, children: [ guard(responseExample.summary, (summary) => [ - create("p", { + create("Markdown", { children: ` ${summary}`, }), ]), diff --git a/packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts b/packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts index 7b3ebb600..22b4377a2 100644 --- a/packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts +++ b/packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts @@ -70,6 +70,7 @@ export function createApiPageMD({ `import ResponseSamples from "@theme/ResponseSamples";\n`, `import SchemaItem from "@theme/SchemaItem";\n`, `import SchemaTabs from "@theme/SchemaTabs";\n`, + `import Markdown from "@theme/Markdown";\n`, `import OperationTabs from "@theme/OperationTabs";\n`, `import TabItem from "@theme/TabItem";\n\n`, createHeading(title), diff --git a/packages/docusaurus-theme-openapi-docs/package.json b/packages/docusaurus-theme-openapi-docs/package.json index 17c0daff5..8b2c30253 100644 --- a/packages/docusaurus-theme-openapi-docs/package.json +++ b/packages/docusaurus-theme-openapi-docs/package.json @@ -1,7 +1,7 @@ { "name": "docusaurus-theme-openapi-docs", "description": "OpenAPI theme for Docusaurus.", - "version": "3.0.0-beta.4", + "version": "3.0.0-beta.5", "license": "MIT", "keywords": [ "openapi", @@ -44,7 +44,7 @@ "clsx": "^1.1.1", "copy-text-to-clipboard": "^3.1.0", "crypto-js": "^4.1.1", - "docusaurus-plugin-openapi-docs": "^3.0.0-beta.4", + "docusaurus-plugin-openapi-docs": "^3.0.0-beta.5", "docusaurus-plugin-sass": "^0.2.3", "file-saver": "^2.0.5", "lodash": "^4.17.20", diff --git a/packages/docusaurus-theme-openapi-docs/src/theme-openapi.d.ts b/packages/docusaurus-theme-openapi-docs/src/theme-openapi.d.ts index b2dbef810..cb7c171f8 100644 --- a/packages/docusaurus-theme-openapi-docs/src/theme-openapi.d.ts +++ b/packages/docusaurus-theme-openapi-docs/src/theme-openapi.d.ts @@ -65,6 +65,10 @@ declare module "@theme/SchemaTabs" { export default function SchemaTabs(props: any): JSX.Element; } +declare module "@theme/Markdown" { + export default function Markdown(props: any): JSX.Element; +} + declare module "@theme/ApiExplorer/Accept" { export default function Accept(): JSX.Element; } diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Body/index.tsx b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Body/index.tsx index 816c00fe6..b0dad0689 100644 --- a/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Body/index.tsx +++ b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Body/index.tsx @@ -14,6 +14,7 @@ import FormSelect from "@theme/ApiExplorer/FormSelect"; import FormTextInput from "@theme/ApiExplorer/FormTextInput"; import LiveApp from "@theme/ApiExplorer/LiveEditor"; import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks"; +import Markdown from "@theme/Markdown"; import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; import { RequestBodyObject } from "docusaurus-plugin-openapi-docs/src/openapi/types"; @@ -303,6 +304,7 @@ function Body({ {/* @ts-ignore */} + {example.summary && } {exampleBody && ( - {example.summary &&

{example.summary}

} + {example.summary && } {example.body && ( {example.body} diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/languages.json b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/languages.json new file mode 100644 index 000000000..36c345a3b --- /dev/null +++ b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/languages.json @@ -0,0 +1,1290 @@ +[ + { + "key": "csharp", + "label": "C#", + "syntax_mode": "csharp", + "variants": [ + { + "key": "RestSharp", + "options": [ + { + "name": "Include boilerplate", + "id": "includeBoilerplate", + "type": "boolean", + "default": false, + "description": "Include class definition and import statements in snippet" + }, + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + } + ] + }, + { + "key": "curl", + "label": "cURL", + "syntax_mode": "powershell", + "variants": [ + { + "key": "cURL", + "options": [ + { + "name": "Generate multiline snippet", + "id": "multiLine", + "type": "boolean", + "default": true, + "description": "Split cURL command across multiple lines" + }, + { + "name": "Use long form options", + "id": "longFormat", + "type": "boolean", + "default": true, + "description": "Use the long form for cURL options (--header instead of -H)" + }, + { + "name": "Line continuation character", + "id": "lineContinuationCharacter", + "availableOptions": ["\\", "^", "`"], + "type": "enum", + "default": "\\", + "description": "Set a character used to mark the continuation of a statement on the next line (generally, \\ for OSX/Linux, ^ for Windows cmd and ` for Powershell)" + }, + { + "name": "Quote Type", + "id": "quoteType", + "availableOptions": ["single", "double"], + "type": "enum", + "default": "single", + "description": "String denoting the quote type to use (single or double) for URL (Use double quotes when running curl in cmd.exe and single quotes for the rest)" + }, + { + "name": "Set request timeout (in seconds)", + "id": "requestTimeoutInSeconds", + "type": "positiveInteger", + "default": 0, + "description": "Set number of seconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Use Silent Mode", + "id": "silent", + "type": "boolean", + "default": false, + "description": "Display the requested data without showing the cURL progress meter or error messages" + } + ] + } + ] + }, + { + "key": "dart", + "label": "Dart", + "syntax_mode": "dart", + "variants": [ + { + "key": "http", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Include boilerplate", + "id": "includeBoilerplate", + "type": "boolean", + "default": false, + "description": "Include class definition and import statements in snippet" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + } + ] + } + ] + }, + { + "key": "go", + "label": "Go", + "syntax_mode": "golang", + "variants": [ + { + "key": "Native", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + } + ] + }, + { + "key": "http", + "label": "HTTP", + "syntax_mode": "text", + "variants": [ + { + "key": "HTTP", + "options": [ + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + } + ] + }, + { + "key": "java", + "label": "Java", + "syntax_mode": "java", + "variants": [ + { + "key": "OkHttp", + "options": [ + { + "name": "Include boilerplate", + "id": "includeBoilerplate", + "type": "boolean", + "default": false, + "description": "Include class definition and import statements in snippet" + }, + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + }, + { + "key": "Unirest", + "options": [ + { + "name": "Include boilerplate", + "id": "includeBoilerplate", + "type": "boolean", + "default": false, + "description": "Include class definition and import statements in snippet" + }, + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + } + ] + }, + { + "key": "javascript", + "label": "JavaScript", + "syntax_mode": "javascript", + "variants": [ + { + "key": "Fetch", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + }, + { + "key": "jQuery", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + }, + { + "key": "XHR", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + } + ] + }, + { + "key": "c", + "label": "C", + "syntax_mode": "c_cpp", + "variants": [ + { + "key": "libcurl", + "options": [ + { + "name": "Include boilerplate", + "id": "includeBoilerplate", + "type": "boolean", + "default": false, + "description": "Include class definition and import statements in snippet" + }, + { + "name": "Protocol", + "id": "protocol", + "type": "enum", + "availableOptions": ["http", "https"], + "default": "https", + "description": "The protocol to be used to make the request" + }, + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Use curl_mime", + "id": "useMimeType", + "type": "boolean", + "default": true, + "description": "Use curl_mime to send multipart/form-data requests" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + } + ] + } + ] + }, + { + "key": "nodejs", + "label": "NodeJs", + "syntax_mode": "javascript", + "variants": [ + { + "key": "Axios", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Enable ES6 features", + "id": "ES6_enabled", + "type": "boolean", + "default": false, + "description": "Modifies code snippet to incorporate ES6 (EcmaScript) features" + } + ] + }, + { + "key": "Native", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Enable ES6 features", + "id": "ES6_enabled", + "type": "boolean", + "default": false, + "description": "Modifies code snippet to incorporate ES6 (EcmaScript) features" + } + ] + } + ] + }, + { + "key": "objective-c", + "label": "Objective-C", + "syntax_mode": "objectivec", + "variants": [ + { + "key": "NSURLSession", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 10000, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Include boilerplate", + "id": "includeBoilerplate", + "type": "boolean", + "default": false, + "description": "Include class definition and import statements in snippet" + } + ] + } + ] + }, + { + "key": "ocaml", + "label": "OCaml", + "syntax_mode": "ocaml", + "variants": [ + { + "key": "Cohttp", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + } + ] + } + ] + }, + { + "key": "php", + "label": "PHP", + "syntax_mode": "php", + "variants": [ + { + "key": "cURL", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + }, + { + "key": "Guzzle", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Set communication type", + "id": "asyncType", + "type": "enum", + "availableOptions": ["async", "sync"], + "default": "async", + "description": "Set if the requests will be asynchronous or synchronous" + }, + { + "name": "Include boilerplate", + "id": "includeBoilerplate", + "type": "boolean", + "default": false, + "description": "Include class definition and import statements in snippet" + } + ] + }, + { + "key": "HTTP_Request2", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "default": "Space", + "availableOptions": ["Tab", "Space"], + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + } + ] + }, + { + "key": "pecl_http", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "default": "Space", + "availableOptions": ["Tab", "Space"], + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + } + ] + } + ] + }, + { + "key": "powershell", + "label": "PowerShell", + "syntax_mode": "powershell", + "variants": [ + { + "key": "RestMethod", + "options": [ + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + } + ] + }, + { + "key": "python", + "label": "Python", + "syntax_mode": "python", + "variants": [ + { + "key": "http.client", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "default": "Space", + "availableOptions": ["Tab", "Space"], + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + }, + { + "key": "Requests", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + } + ] + }, + { + "key": "r", + "label": "R", + "syntax_mode": "r", + "variants": [ + { + "key": "httr", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + } + ] + }, + { + "key": "RCurl", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Ignore warnings", + "id": "ignoreWarnings", + "type": "boolean", + "default": false, + "description": "Ignore warnings from R" + } + ] + } + ] + }, + { + "key": "ruby", + "label": "Ruby", + "syntax_mode": "ruby", + "variants": [ + { + "key": "Net::HTTP", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + } + ] + }, + { + "key": "shell", + "label": "Shell", + "syntax_mode": "powershell", + "variants": [ + { + "key": "Httpie", + "options": [ + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + } + ] + }, + { + "key": "wget", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + } + ] + } + ] + }, + { + "key": "swift", + "label": "Swift", + "syntax_mode": "swift", + "variants": [ + { + "key": "URLSession", + "options": [ + { + "name": "Set indentation count", + "id": "indentCount", + "type": "positiveInteger", + "default": 2, + "description": "Set the number of indentation characters to add per code level" + }, + { + "name": "Set indentation type", + "id": "indentType", + "type": "enum", + "availableOptions": ["Tab", "Space"], + "default": "Space", + "description": "Select the character used to indent lines of code" + }, + { + "name": "Set request timeout", + "id": "requestTimeout", + "type": "positiveInteger", + "default": 0, + "description": "Set number of milliseconds the request should wait for a response before timing out (use 0 for infinity)" + }, + { + "name": "Trim request body fields", + "id": "trimRequestBody", + "type": "boolean", + "default": false, + "description": "Remove white space and additional lines that may affect the server's response" + }, + { + "name": "Follow redirects", + "id": "followRedirect", + "type": "boolean", + "default": true, + "description": "Automatically follow HTTP redirects" + } + ] + } + ] + } +] diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/Markdown/index.js b/packages/docusaurus-theme-openapi-docs/src/theme/Markdown/index.js new file mode 100644 index 000000000..13ce11a65 --- /dev/null +++ b/packages/docusaurus-theme-openapi-docs/src/theme/Markdown/index.js @@ -0,0 +1,37 @@ +/* ============================================================================ + * Copyright (c) Palo Alto Networks + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * ========================================================================== */ + +import React from "react"; + +import CodeBlock from "@theme/CodeBlock"; +import ReactMarkdown from "react-markdown"; +import rehypeRaw from "rehype-raw"; + +function Markdown({ children }) { + return ( +
+ {children}; + return !inline && match ? ( + {children} + ) : ( + {children} + ); + }, + }} + /> +
+ ); +} + +export default Markdown; diff --git a/yarn.lock b/yarn.lock index 35ea11a5e..ed6e4a41e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1709,6 +1709,13 @@ resolved "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== +"@eslint-community/eslint-utils@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c"