diff --git a/dist/swagger-ui-bundle.js.LICENSE.txt b/dist/swagger-ui-bundle.js.LICENSE.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dist/swagger-ui-es-bundle-core.js.LICENSE.txt b/dist/swagger-ui-es-bundle-core.js.LICENSE.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dist/swagger-ui-es-bundle.js.LICENSE.txt b/dist/swagger-ui-es-bundle.js.LICENSE.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dist/swagger-ui-standalone-preset.js.LICENSE.txt b/dist/swagger-ui-standalone-preset.js.LICENSE.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/core/components/info.jsx b/src/core/components/info.jsx index ad2475758bb..1de50a7113b 100644 --- a/src/core/components/info.jsx +++ b/src/core/components/info.jsx @@ -97,13 +97,13 @@ class Info extends React.Component { return (
-

+

{title} {version && } -

+ {host || basePath ? ( ) : null} diff --git a/src/core/components/responses.jsx b/src/core/components/responses.jsx index fe1f7ddcb8b..2d47d9b4fff 100644 --- a/src/core/components/responses.jsx +++ b/src/core/components/responses.jsx @@ -167,4 +167,4 @@ export default class Responses extends React.Component {
) } -} +} \ No newline at end of file diff --git a/src/core/plugins/oas31/components/info.jsx b/src/core/plugins/oas31/components/info.jsx index be145764ba5..891e55e1b68 100644 --- a/src/core/plugins/oas31/components/info.jsx +++ b/src/core/plugins/oas31/components/info.jsx @@ -33,13 +33,13 @@ const Info = ({ getComponent, specSelectors }) => { return (
-

+

{title} {version && } -

+ {(host || basePath) && } {url && } diff --git a/src/core/plugins/request-snippets/fn.js b/src/core/plugins/request-snippets/fn.js index aea7c215657..845f17ce26e 100644 --- a/src/core/plugins/request-snippets/fn.js +++ b/src/core/plugins/request-snippets/fn.js @@ -28,11 +28,12 @@ const escapeShell = (str) => { return str } -const escapeCMD = (str) => { +export const escapeCMD = (str) => { str = str .replace(/\^/g, "^^") .replace(/\\"/g, "\\\\\"") .replace(/"/g, "\"\"") + .replace(/\|/g, "^|") .replace(/\n/g, "^\n") if (str === "-d ") { return str @@ -167,3 +168,5 @@ export const requestSnippetGenerator_curl_bash = (request) => { export const requestSnippetGenerator_curl_cmd = (request) => { return curlify(request, escapeCMD, "^\n") } + + diff --git a/src/core/utils/index.js b/src/core/utils/index.js index 9b008587f84..8d863b4de86 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -704,16 +704,12 @@ export const createDeepLinkPath = (str) => typeof str == "string" || str instanc // suitable for use in CSS classes and ids export const escapeDeepLinkPath = (str) => cssEscape( createDeepLinkPath(str).replace(/%20/g, "_") ) -export const isExtension = (key) => { - const extensionRegExp = /^x-/ - return extensionRegExp.test(key) -} - export const getExtensions = (defObj) => { + const extensionRegExp = /^x-/ if(Map.isMap(defObj)) { - return defObj.filter((v, k) => isExtension(k)) + return defObj.filter((v, k) => extensionRegExp.test(k)) } - return Object.keys(defObj).filter((key) => isExtension(key)) + return Object.keys(defObj).filter((key) => extensionRegExp.test(key)) } export const getCommonExtensions = (defObj) => defObj.filter((v, k) => /^pattern|maxLength|minLength|maximum|minimum/.test(k)) diff --git a/test/e2e-cypress/e2e/bugs/5138.cy.js b/test/e2e-cypress/e2e/bugs/5138.cy.js index 51705a7b313..0f826b12f88 100644 --- a/test/e2e-cypress/e2e/bugs/5138.cy.js +++ b/test/e2e-cypress/e2e/bugs/5138.cy.js @@ -2,7 +2,7 @@ describe("#5138: unwanted `url`/`urls` interactions", () => { it("should stably render the first `urls` entry", () => { cy .visit("/pages/5138/") - .get("h1.title") + .get("h2.title") .contains("USPTO Data Set API") .wait(3000) .contains("USPTO Data Set API") diff --git a/test/e2e-cypress/e2e/features/urls.cy.js b/test/e2e-cypress/e2e/features/urls.cy.js index b1e37f53995..45f576f9791 100644 --- a/test/e2e-cypress/e2e/features/urls.cy.js +++ b/test/e2e-cypress/e2e/features/urls.cy.js @@ -19,7 +19,7 @@ describe("configuration options: `urls` and `urls.primaryName`", () => { it("should render the first URL in the list", () => { cy.visit("/?configUrl=/configs/urls.yaml") - .get("h1.title") + .get("h2.title") .should("have.text", "OneOAS 2.0") .window() .then(win => win.ui.specSelectors.url()) @@ -31,7 +31,7 @@ describe("configuration options: `urls` and `urls.primaryName`", () => { cy.visit("/?configUrl=/configs/urls-primary-name.yaml") .get("select") .should("contain.value", "/documents/features/urls/2.yaml") - .get("h1.title") + .get("h2.title") .should("have.text", "TwoOAS 3.0") .window() .then(win => win.ui.specSelectors.url()) diff --git a/test/prefixitems-example.yaml b/test/prefixitems-example.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/unit/core/plugins/request-snippets/fn.js b/test/unit/core/plugins/request-snippets/fn.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/unit/core/plugins/request-snippets/fn.test.js b/test/unit/core/plugins/request-snippets/fn.test.js new file mode 100644 index 00000000000..d8e8322afdb --- /dev/null +++ b/test/unit/core/plugins/request-snippets/fn.test.js @@ -0,0 +1,15 @@ + +const { escapeCMD } = require("../../../../../src/core/plugins/request-snippets/fn") + +describe("escapeCMD", function() { + it("escapes vertical bar | with caret ^ for CMD", function() { + const input = "foo|bar" + const output = escapeCMD(input) + expect(output).toContain("^|") + }) + + it("escapes other CMD special characters", function() { + expect(escapeCMD("foo^bar")).toContain("^^") + expect(escapeCMD("foo\"bar")).toContain("\"\"") + }) +})