From c508949c5450b22053577a87c0824df10190adfc Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Tue, 15 Mar 2022 17:27:27 +0200 Subject: [PATCH 01/43] chore: cli-v0.13.9 (#1933) --- cli/npm-shrinkwrap.json | 26 ++++++++++++-------------- cli/package.json | 4 ++-- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/cli/npm-shrinkwrap.json b/cli/npm-shrinkwrap.json index 8aa5319e..3d20a594 100644 --- a/cli/npm-shrinkwrap.json +++ b/cli/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "redoc-cli", - "version": "0.13.8", + "version": "0.13.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "redoc-cli", - "version": "0.13.8", + "version": "0.13.9", "license": "MIT", "dependencies": { "chokidar": "^3.5.1", @@ -17,7 +17,7 @@ "node-libs-browser": "^2.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", - "redoc": "2.0.0-rc.64", + "redoc": "2.0.0-rc.65", "styled-components": "^5.3.0", "yargs": "^17.0.1" }, @@ -1273,9 +1273,7 @@ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "hasInstallScript": true, "optional": true, - "os": [ - "darwin" - ], + "os": ["darwin"], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } @@ -2219,9 +2217,9 @@ } }, "node_modules/redoc": { - "version": "2.0.0-rc.64", - "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.64.tgz", - "integrity": "sha512-zrM/vcONpbmyDUOpk7Ai7R/yZrT7W1+8ANJUB3b5kzaLQUx4VbrDoT4D6HHHquOnKx+5We4nOPPAi8fi/cqa8g==", + "version": "2.0.0-rc.65", + "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.65.tgz", + "integrity": "sha512-VqJbhb3krYXFP8De7ygyaWsA4jr9K5avsMo3GJUDv2xPiHTOzcprkIfOaL4ZdINn03x6JT1GOa47cWhrmb5KVA==", "dependencies": { "@redocly/openapi-core": "^1.0.0-beta.54", "@redocly/react-dropdown-aria": "^2.0.11", @@ -2238,7 +2236,7 @@ "path-browserify": "^1.0.1", "perfect-scrollbar": "^1.5.1", "polished": "^4.1.3", - "prismjs": "^1.24.1", + "prismjs": "^1.27.0", "prop-types": "^15.7.2", "react-tabs": "^3.2.2", "slugify": "~1.4.7", @@ -4824,9 +4822,9 @@ } }, "redoc": { - "version": "2.0.0-rc.64", - "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.64.tgz", - "integrity": "sha512-zrM/vcONpbmyDUOpk7Ai7R/yZrT7W1+8ANJUB3b5kzaLQUx4VbrDoT4D6HHHquOnKx+5We4nOPPAi8fi/cqa8g==", + "version": "2.0.0-rc.65", + "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.65.tgz", + "integrity": "sha512-VqJbhb3krYXFP8De7ygyaWsA4jr9K5avsMo3GJUDv2xPiHTOzcprkIfOaL4ZdINn03x6JT1GOa47cWhrmb5KVA==", "requires": { "@redocly/openapi-core": "^1.0.0-beta.54", "@redocly/react-dropdown-aria": "^2.0.11", @@ -4843,7 +4841,7 @@ "path-browserify": "^1.0.1", "perfect-scrollbar": "^1.5.1", "polished": "^4.1.3", - "prismjs": "^1.24.1", + "prismjs": "^1.27.0", "prop-types": "^15.7.2", "react-tabs": "^3.2.2", "slugify": "~1.4.7", diff --git a/cli/package.json b/cli/package.json index e33bb0af..ee252e55 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "redoc-cli", - "version": "0.13.8", + "version": "0.13.9", "description": "ReDoc's Command Line Interface", "main": "index.js", "bin": "index.js", @@ -19,7 +19,7 @@ "node-libs-browser": "^2.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", - "redoc": "2.0.0-rc.64", + "redoc": "2.0.0-rc.65", "styled-components": "^5.3.0", "yargs": "^17.0.1" }, From 95dbfc930ff9fcbeba5bb6b262157f854b26bdc2 Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Fri, 18 Mar 2022 17:30:23 +0200 Subject: [PATCH 02/43] chore: update openapi-core and yargs libs (#1934) --- cli/npm-shrinkwrap.json | 68 +++++++++++++------------- cli/package.json | 2 +- package-lock.json | 104 ++++++++++++++++------------------------ package.json | 4 +- 4 files changed, 78 insertions(+), 100 deletions(-) diff --git a/cli/npm-shrinkwrap.json b/cli/npm-shrinkwrap.json index 3d20a594..2803d823 100644 --- a/cli/npm-shrinkwrap.json +++ b/cli/npm-shrinkwrap.json @@ -19,7 +19,7 @@ "react-dom": "^17.0.1", "redoc": "2.0.0-rc.65", "styled-components": "^5.3.0", - "yargs": "^17.0.1" + "yargs": "^17.3.1" }, "bin": { "redoc-cli": "index.js" @@ -2491,24 +2491,24 @@ } }, "node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" } }, "node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dependencies": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" @@ -2951,28 +2951,28 @@ "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==" }, "node_modules/yargs": { - "version": "17.0.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.0.1.tgz", - "integrity": "sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==", + "version": "17.3.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.3.1.tgz", + "integrity": "sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==", "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "string-width": "^4.2.0", + "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "yargs-parser": "^21.0.0" }, "engines": { "node": ">=12" } }, "node_modules/yargs-parser": { - "version": "20.2.7", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", - "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz", + "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==", "engines": { - "node": ">=10" + "node": ">=12" } } }, @@ -5048,21 +5048,21 @@ } }, "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" } }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" } }, "style-loader": { @@ -5376,23 +5376,23 @@ "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==" }, "yargs": { - "version": "17.0.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.0.1.tgz", - "integrity": "sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==", + "version": "17.3.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.3.1.tgz", + "integrity": "sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==", "requires": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "string-width": "^4.2.0", + "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "yargs-parser": "^21.0.0" } }, "yargs-parser": { - "version": "20.2.7", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", - "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==" + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz", + "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==" } } } diff --git a/cli/package.json b/cli/package.json index ee252e55..ebc5e3b3 100644 --- a/cli/package.json +++ b/cli/package.json @@ -21,7 +21,7 @@ "react-dom": "^17.0.1", "redoc": "2.0.0-rc.65", "styled-components": "^5.3.0", - "yargs": "^17.0.1" + "yargs": "^17.3.1" }, "publishConfig": { "access": "public" diff --git a/package-lock.json b/package-lock.json index 2f4ad19c..cd081921 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "2.0.0-rc.65", "license": "MIT", "dependencies": { - "@redocly/openapi-core": "^1.0.0-beta.54", + "@redocly/openapi-core": "^1.0.0-beta.88", "@redocly/react-dropdown-aria": "^2.0.11", "classnames": "^2.3.1", "decko": "^1.2.0", @@ -2554,9 +2554,9 @@ } }, "node_modules/@redocly/ajv": { - "version": "8.6.2", - "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.6.2.tgz", - "integrity": "sha512-tU8fQs0D76ZKhJ2cWtnfQthWqiZgGBx0gH0+5D8JvaBEBaqA8foPPBt3Nonwr3ygyv5xrw2IzKWgIY86BlGs+w==", + "version": "8.6.4", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.6.4.tgz", + "integrity": "sha512-y9qNj0//tZtWB2jfXNK3BX18BSBp9zNR7KE7lMysVHwbZtY392OJCjm6Rb/h4UHH2r1AqjNEHFD6bRn+DqU9Mw==", "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -2574,18 +2574,19 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/@redocly/openapi-core": { - "version": "1.0.0-beta.54", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.54.tgz", - "integrity": "sha512-uYs0N1Trjkh7u8IMIuCU2VxCXhMyGWSZUkP/WNdTR1OgBUtvNdF9C32zoQV+hyCIH4gVu42ROHkjisy333ZX+w==", + "version": "1.0.0-beta.88", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.88.tgz", + "integrity": "sha512-E9vkLvumIkzII0ydDFGr6uYbZgI9rHMxBveefzM51OUvobvifryXb6VcnQ1T0P8VoHRiYwpgiWlmZeDsNAdZdg==", "dependencies": { - "@redocly/ajv": "^8.6.2", + "@redocly/ajv": "^8.6.4", "@types/node": "^14.11.8", "colorette": "^1.2.0", "js-levenshtein": "^1.1.6", - "js-yaml": "^3.14.1", + "js-yaml": "^4.1.0", "lodash.isequal": "^4.5.0", "minimatch": "^3.0.4", "node-fetch": "^2.6.1", + "pluralize": "^8.0.0", "yaml-ast-parser": "0.0.43" }, "engines": { @@ -2597,26 +2598,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.3.tgz", "integrity": "sha512-e6ZowgGJmTuXa3GyaPbTGxX17tnThl2aSSizrFthQ7m9uLGZBXiGhgE55cjRZTF5kjZvYn9EOPOMljdjwbflxw==" }, - "node_modules/@redocly/openapi-core/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@redocly/openapi-core/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/@redocly/react-dropdown-aria": { "version": "2.0.12", "resolved": "https://registry.npmjs.org/@redocly/react-dropdown-aria/-/react-dropdown-aria-2.0.12.tgz", @@ -3917,8 +3898,7 @@ "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/array-differ": { "version": "3.0.0", @@ -7596,6 +7576,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -12331,7 +12312,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, "dependencies": { "argparse": "^2.0.1" }, @@ -14584,6 +14564,14 @@ "node": ">=4" } }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "engines": { + "node": ">=4" + } + }, "node_modules/polished": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/polished/-/polished-4.1.3.tgz", @@ -16691,7 +16679,8 @@ "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, "node_modules/sshpk": { "version": "1.16.1", @@ -20914,9 +20903,9 @@ } }, "@redocly/ajv": { - "version": "8.6.2", - "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.6.2.tgz", - "integrity": "sha512-tU8fQs0D76ZKhJ2cWtnfQthWqiZgGBx0gH0+5D8JvaBEBaqA8foPPBt3Nonwr3ygyv5xrw2IzKWgIY86BlGs+w==", + "version": "8.6.4", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.6.4.tgz", + "integrity": "sha512-y9qNj0//tZtWB2jfXNK3BX18BSBp9zNR7KE7lMysVHwbZtY392OJCjm6Rb/h4UHH2r1AqjNEHFD6bRn+DqU9Mw==", "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -20932,18 +20921,19 @@ } }, "@redocly/openapi-core": { - "version": "1.0.0-beta.54", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.54.tgz", - "integrity": "sha512-uYs0N1Trjkh7u8IMIuCU2VxCXhMyGWSZUkP/WNdTR1OgBUtvNdF9C32zoQV+hyCIH4gVu42ROHkjisy333ZX+w==", + "version": "1.0.0-beta.88", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.88.tgz", + "integrity": "sha512-E9vkLvumIkzII0ydDFGr6uYbZgI9rHMxBveefzM51OUvobvifryXb6VcnQ1T0P8VoHRiYwpgiWlmZeDsNAdZdg==", "requires": { - "@redocly/ajv": "^8.6.2", + "@redocly/ajv": "^8.6.4", "@types/node": "^14.11.8", "colorette": "^1.2.0", "js-levenshtein": "^1.1.6", - "js-yaml": "^3.14.1", + "js-yaml": "^4.1.0", "lodash.isequal": "^4.5.0", "minimatch": "^3.0.4", "node-fetch": "^2.6.1", + "pluralize": "^8.0.0", "yaml-ast-parser": "0.0.43" }, "dependencies": { @@ -20951,23 +20941,6 @@ "version": "14.17.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.3.tgz", "integrity": "sha512-e6ZowgGJmTuXa3GyaPbTGxX17tnThl2aSSizrFthQ7m9uLGZBXiGhgE55cjRZTF5kjZvYn9EOPOMljdjwbflxw==" - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } } } }, @@ -22065,8 +22038,7 @@ "argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "array-differ": { "version": "3.0.0", @@ -24870,7 +24842,8 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true }, "esquery": { "version": "1.4.0", @@ -28397,7 +28370,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, "requires": { "argparse": "^2.0.1" } @@ -30104,6 +30076,11 @@ "find-up": "^2.1.0" } }, + "pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==" + }, "polished": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/polished/-/polished-4.1.3.tgz", @@ -31777,7 +31754,8 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, "sshpk": { "version": "1.16.1", diff --git a/package.json b/package.json index 86ef7deb..23eabbd7 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "compile:cli": "tsc custom.d.ts cli/index.ts --target es6 --module commonjs --types yargs", "build:demo": "webpack --mode=production --config demo/webpack.config.ts", "deploy:demo": "aws s3 sync demo/dist s3://production-redoc-demo --acl=public-read", - "license-check": "license-checker --production --onlyAllow 'MIT;ISC;Apache-2.0;BSD;BSD-2-Clause;BSD-3-Clause;CC-BY-4.0' --summary", + "license-check": "license-checker --production --onlyAllow 'MIT;ISC;Apache-2.0;BSD;BSD-2-Clause;BSD-3-Clause;CC-BY-4.0;Python-2.0' --summary", "docker:build": "docker build -f config/docker/Dockerfile -t redoc .", "prepare": "husky install", "pre-commit": "pretty-quick --staged && npm run lint" @@ -139,7 +139,7 @@ "styled-components": "^4.1.1 || ^5.1.1" }, "dependencies": { - "@redocly/openapi-core": "^1.0.0-beta.54", + "@redocly/openapi-core": "^1.0.0-beta.88", "@redocly/react-dropdown-aria": "^2.0.11", "classnames": "^2.3.1", "decko": "^1.2.0", From 30b3b57b2693aef55181722eab74d297e6bb25ea Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Mon, 21 Mar 2022 15:51:23 +0200 Subject: [PATCH 03/43] chore: update docs about support IE 11 (#1938) --- README.md | 3 --- docs/usage-with-ie11.md | 24 ------------------------ 2 files changed, 27 deletions(-) delete mode 100644 docs/usage-with-ie11.md diff --git a/README.md b/README.md index 292a23aa..9ebf440b 100644 --- a/README.md +++ b/README.md @@ -176,9 +176,6 @@ For step-by-step instructions for how to get started using Redoc to render your OpenAPI definition, refer to the [**Redoc quickstart guide**](https://redoc.ly/docs/redoc/quickstart/intro/). -See [**IE11 Support Notes**](docs/usage-with-ie11.md) for information on -IE support for Redoc. - ## Redoc CLI For more information on Redoc's commmand-line interface, refer to [**Using the Redoc CLI**](https://redoc.ly/docs/redoc/quickstart/cli/). diff --git a/docs/usage-with-ie11.md b/docs/usage-with-ie11.md deleted file mode 100644 index 985728b9..00000000 --- a/docs/usage-with-ie11.md +++ /dev/null @@ -1,24 +0,0 @@ -# Usage With IE11 - - -## Standalone package - -IE11 is supported by default if you use ReDoc as a standalone package. - -## Usage as a React component - -If you use ReDoc as a React component you should include the following polyfills in your project: - -```js -import 'core-js/es6/promise'; -import 'core-js/fn/array/find'; -import 'core-js/fn/object/assign'; -import 'core-js/fn/string/ends-with'; -import 'core-js/fn/string/starts-with'; - -import 'core-js/es6/map'; -import 'core-js/es6/symbol'; - -import 'unfetch/polyfill/index'; // or any other fetch polyfill -import 'url-polyfill'; -``` From 117071ee83a32d9b3350d8afe2bdb6365a44e2ec Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Mon, 21 Mar 2022 15:56:12 +0200 Subject: [PATCH 04/43] fix: add handle local files for serve command (#1810) --- cli/index.ts | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/cli/index.ts b/cli/index.ts index 10e82b2c..e9042707 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -6,7 +6,7 @@ import { ServerStyleSheet } from 'styled-components'; import { compile } from 'handlebars'; import { createServer, IncomingMessage, ServerResponse } from 'http'; -import { dirname, join, resolve } from 'path'; +import { dirname, join, resolve, extname as getExtName } from 'path'; import * as zlib from 'zlib'; @@ -39,6 +39,24 @@ interface Options { redocOptions?: any; } +export const mimeTypes = { + '.html': 'text/html', + '.js': 'text/javascript', + '.css': 'text/css', + '.json': 'application/json', + '.png': 'image/png', + '.jpg': 'image/jpg', + '.gif': 'image/gif', + '.svg': 'image/svg+xml', + '.wav': 'audio/wav', + '.mp4': 'video/mp4', + '.woff': 'application/font-woff', + '.ttf': 'application/font-ttf', + '.eot': 'application/vnd.ms-fontobject', + '.otf': 'application/font-otf', + '.wasm': 'application/wasm', +}; + const BUNDLES_DIR = dirname(require.resolve('redoc')); /* tslint:disable-next-line */ @@ -197,9 +215,19 @@ async function serve(host: string, port: number, pathToSpec: string, options: Op 'Content-Type': 'application/json', }); } else { - response.writeHead(404); - response.write('Not found'); - response.end(); + try { + const filePath = join(dirname(pathToSpec), request.url || ''); + const extname = String(getExtName(filePath)).toLowerCase() as keyof typeof mimeTypes; + + const contentType = mimeTypes[extname] || 'application/octet-stream'; + respondWithGzip(createReadStream(filePath), request, response, { + 'Content-Type': contentType, + }); + } catch (e) { + response.writeHead(404); + response.write('Not found'); + response.end(); + } } console.timeEnd('GET ' + request.url); From a36610b3c5686351001d9fcd8ad6d2e936db5cb9 Mon Sep 17 00:00:00 2001 From: redocly-bot Date: Mon, 21 Mar 2022 14:25:04 +0000 Subject: [PATCH 05/43] sync: Synced local 'docs/' with remote 'docs/redoc/' --- docs/usage-with-ie11.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/usage-with-ie11.md diff --git a/docs/usage-with-ie11.md b/docs/usage-with-ie11.md new file mode 100644 index 00000000..985728b9 --- /dev/null +++ b/docs/usage-with-ie11.md @@ -0,0 +1,24 @@ +# Usage With IE11 + + +## Standalone package + +IE11 is supported by default if you use ReDoc as a standalone package. + +## Usage as a React component + +If you use ReDoc as a React component you should include the following polyfills in your project: + +```js +import 'core-js/es6/promise'; +import 'core-js/fn/array/find'; +import 'core-js/fn/object/assign'; +import 'core-js/fn/string/ends-with'; +import 'core-js/fn/string/starts-with'; + +import 'core-js/es6/map'; +import 'core-js/es6/symbol'; + +import 'unfetch/polyfill/index'; // or any other fetch polyfill +import 'url-polyfill'; +``` From 0c23f8d0519d063b88483f26d2485f3ac1d1e58d Mon Sep 17 00:00:00 2001 From: redocly-bot Date: Mon, 21 Mar 2022 14:48:22 +0000 Subject: [PATCH 06/43] sync: Synced local 'docs/' with remote 'docs/redoc/' --- docs/usage-with-ie11.md | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 docs/usage-with-ie11.md diff --git a/docs/usage-with-ie11.md b/docs/usage-with-ie11.md deleted file mode 100644 index 985728b9..00000000 --- a/docs/usage-with-ie11.md +++ /dev/null @@ -1,24 +0,0 @@ -# Usage With IE11 - - -## Standalone package - -IE11 is supported by default if you use ReDoc as a standalone package. - -## Usage as a React component - -If you use ReDoc as a React component you should include the following polyfills in your project: - -```js -import 'core-js/es6/promise'; -import 'core-js/fn/array/find'; -import 'core-js/fn/object/assign'; -import 'core-js/fn/string/ends-with'; -import 'core-js/fn/string/starts-with'; - -import 'core-js/es6/map'; -import 'core-js/es6/symbol'; - -import 'unfetch/polyfill/index'; // or any other fetch polyfill -import 'url-polyfill'; -``` From eb096b69be52568fc581027161c7d0c4b26c56c1 Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Mon, 21 Mar 2022 17:21:02 +0200 Subject: [PATCH 07/43] fix: rename bandle command and add deprecate notice (#1935) Co-authored-by: Roman Hotsiy --- cli/index.ts | 127 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 52 deletions(-) diff --git a/cli/index.ts b/cli/index.ts index e9042707..9f6d764d 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -59,7 +59,58 @@ export const mimeTypes = { const BUNDLES_DIR = dirname(require.resolve('redoc')); -/* tslint:disable-next-line */ +const builderForBuildCommand = yargs => { + yargs.positional('spec', { + describe: 'path or URL to your spec', + }); + + yargs.option('o', { + describe: 'Output file', + alias: 'output', + type: 'string', + default: 'redoc-static.html', + }); + + yargs.options('title', { + describe: 'Page Title', + type: 'string', + }); + + yargs.options('disableGoogleFont', { + describe: 'Disable Google Font', + type: 'boolean', + default: false, + }); + + yargs.option('cdn', { + describe: 'Do not include ReDoc source code into html page, use link to CDN instead', + type: 'boolean', + default: false, + }); + + yargs.demandOption('spec'); + return yargs; +}; + +const handlerForBuildCommand = async (argv: any) => { + const config = { + ssr: true, + output: argv.o as string, + cdn: argv.cdn as boolean, + title: argv.title as string, + disableGoogleFont: argv.disableGoogleFont as boolean, + templateFileName: argv.template as string, + templateOptions: argv.templateOptions || {}, + redocOptions: getObjectOrJSON(argv.options), + }; + + try { + await bundle(argv.spec, config); + } catch (e) { + handleError(e); + } +}; + YargsParser.command( 'serve ', 'start the server', @@ -122,60 +173,32 @@ YargsParser.command( handleError(e); } }, + [ + res => { + console.log( + `\n⚠️ This command is deprecated. Use "npx @redocly/openapi-cli preview-docs petstore.yaml"\n`, + ); + return res; + }, + ], ) + .command( + 'build ', + 'build definition into zero-dependency HTML-file', + builderForBuildCommand, + handlerForBuildCommand, + ) .command( 'bundle ', - 'bundle spec into zero-dependency HTML-file', - yargs => { - yargs.positional('spec', { - describe: 'path or URL to your spec', - }); - - yargs.option('o', { - describe: 'Output file', - alias: 'output', - type: 'string', - default: 'redoc-static.html', - }); - - yargs.options('title', { - describe: 'Page Title', - type: 'string', - }); - - yargs.options('disableGoogleFont', { - describe: 'Disable Google Font', - type: 'boolean', - default: false, - }); - - yargs.option('cdn', { - describe: 'Do not include ReDoc source code into html page, use link to CDN instead', - type: 'boolean', - default: false, - }); - - yargs.demandOption('spec'); - return yargs; - }, - async (argv: any) => { - const config = { - ssr: true, - output: argv.o as string, - cdn: argv.cdn as boolean, - title: argv.title as string, - disableGoogleFont: argv.disableGoogleFont as boolean, - templateFileName: argv.template as string, - templateOptions: argv.templateOptions || {}, - redocOptions: getObjectOrJSON(argv.options), - }; - - try { - await bundle(argv.spec, config); - } catch (e) { - handleError(e); - } - }, + 'bundle spec into zero-dependency HTML-file [deprecated]', + builderForBuildCommand, + handlerForBuildCommand, + [ + res => { + console.log(`\n⚠️ This command is deprecated. Use "build" command instead.\n`); + return res; + }, + ], ) .demandCommand() .options('t', { From ab3e8a8f80f453066c5495e73ac932a8fef0830a Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 23 Mar 2022 10:12:30 +0000 Subject: [PATCH 08/43] fix: move comma out of code block in SecurityRequirement.tsx (#1924) --- .../SecurityRequirement.tsx | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/components/SecurityRequirement/SecurityRequirement.tsx b/src/components/SecurityRequirement/SecurityRequirement.tsx index a5990804..633bdeaa 100644 --- a/src/components/SecurityRequirement/SecurityRequirement.tsx +++ b/src/components/SecurityRequirement/SecurityRequirement.tsx @@ -6,6 +6,23 @@ import { Link, UnderlinedHeader } from '../../common-elements/'; import { SecurityRequirementModel } from '../../services/models/SecurityRequirement'; import { linksCss } from '../Markdown/styled.elements'; +const ScopeNameList = styled.ul` + display: inline; + list-style: none; + padding: 0; + + li { + display: inherit; + + &:after { + content: ','; + } + &:last-child:after { + content: none; + } + } +`; + const ScopeName = styled.code` font-size: ${props => props.theme.typography.code.fontSize}; font-family: ${props => props.theme.typography.code.fontFamily}; @@ -14,13 +31,6 @@ const ScopeName = styled.code` padding: 0.2em; display: inline-block; line-height: 1; - - &:after { - content: ','; - } - &:last-child:after { - content: none; - } `; const SecurityRequirementAndWrap = styled.span` @@ -72,9 +82,13 @@ export class SecurityRequirement extends React.PureComponent {scheme.displayName} {scheme.scopes.length > 0 && ' ('} - {scheme.scopes.map(scope => ( - {scope} - ))} + + {scheme.scopes.map(scope => ( +
  • + {scope} +
  • + ))} +
    {scheme.scopes.length > 0 && ') '} ); From 09786f2a5ade6303ea00512483b172347721ca70 Mon Sep 17 00:00:00 2001 From: Ryc O'Chet Date: Wed, 23 Mar 2022 10:39:26 +0000 Subject: [PATCH 09/43] feat: Add support for displaying operationId in the sidebar (#1927) * feat: Add support for displaying id in the sidebar * fix: previous commit `feat: Add support for displaying id in the sidebar` Co-authored-by: Oprysk --- README.md | 1 + src/services/RedocNormalizedOptions.ts | 3 +++ src/services/models/Operation.ts | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ebf440b..b02a5c97 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,7 @@ You can use all of the following options with the standalone version of the ` theme object * `spacing` diff --git a/src/services/RedocNormalizedOptions.ts b/src/services/RedocNormalizedOptions.ts index 96b8d015..9d1c9ac6 100644 --- a/src/services/RedocNormalizedOptions.ts +++ b/src/services/RedocNormalizedOptions.ts @@ -8,6 +8,7 @@ import { MDXComponentMeta } from './MarkdownRenderer'; export enum SideNavStyleEnum { SummaryOnly = 'summary-only', PathOnly = 'path-only', + IdOnly = 'id-only', } export interface RedocRawOptions { @@ -170,6 +171,8 @@ export class RedocNormalizedOptions { return value; case SideNavStyleEnum.PathOnly: return SideNavStyleEnum.PathOnly; + case SideNavStyleEnum.IdOnly: + return SideNavStyleEnum.IdOnly; default: return defaultValue; } diff --git a/src/services/models/Operation.ts b/src/services/models/Operation.ts index 8e7e9fe5..be9c683b 100644 --- a/src/services/models/Operation.ts +++ b/src/services/models/Operation.ts @@ -106,7 +106,12 @@ export class OperationModel implements IMenuItem { this.name = getOperationSummary(operationSpec); - this.sidebarLabel = options.sideNavStyle === SideNavStyleEnum.PathOnly ? this.path : this.name; + this.sidebarLabel = + options.sideNavStyle === SideNavStyleEnum.IdOnly + ? this.operationId || this.path + : options.sideNavStyle === SideNavStyleEnum.PathOnly + ? this.path + : this.name; if (this.isCallback) { // NOTE: Callbacks by default should not inherit the specification's global `security` definition. From 25be934bb184d7b2b6b47d004b3c83ce4d16a2c6 Mon Sep 17 00:00:00 2001 From: Ajeet Shah Date: Wed, 23 Mar 2022 21:24:11 +0530 Subject: [PATCH 10/43] H2: Set color form theme.colors.text.primary (#1491) * H2: Set color form theme.colors.primary.main * feat: change heading color configuration from `primary.main` to `text.primary` Co-authored-by: Oprysk --- src/common-elements/headers.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common-elements/headers.ts b/src/common-elements/headers.ts index 88b1c377..e5be1649 100644 --- a/src/common-elements/headers.ts +++ b/src/common-elements/headers.ts @@ -15,21 +15,22 @@ export const headerCommonMixin = level => css` export const H1 = styled.h1` ${headerCommonMixin(1)}; - color: ${({ theme }) => theme.colors.primary.main}; + color: ${({ theme }) => theme.colors.text.primary}; ${extensionsHook('H1')}; `; export const H2 = styled.h2` ${headerCommonMixin(2)}; - color: black; + color: ${({ theme }) => theme.colors.text.primary}; + margin: 0 0 20px; ${extensionsHook('H2')}; `; export const H3 = styled.h2` ${headerCommonMixin(3)}; - color: black; + color: ${({ theme }) => theme.colors.text.primary}; ${extensionsHook('H3')}; `; From c75ac9cf70012e2d539b379aab2f0974d088db07 Mon Sep 17 00:00:00 2001 From: Quentin D <4972091+Okhoshi@users.noreply.github.com> Date: Wed, 23 Mar 2022 17:02:30 +0100 Subject: [PATCH 11/43] feat: nonce support (#1566) Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com> Co-authored-by: AlexVarchuk --- README.md | 1 + src/components/RedocStandalone.tsx | 8 ++++++++ src/services/RedocNormalizedOptions.ts | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index b02a5c97..bc5155a6 100644 --- a/README.md +++ b/README.md @@ -243,6 +243,7 @@ You can use all of the following options with the standalone version of the any; } +declare let __webpack_nonce__: string; + export const RedocStandalone = function (props: RedocStandaloneProps) { const { spec, specUrl, options = {}, onLoaded } = props; const hideLoading = argValueToBoolean(options.hideLoading, false); const normalizedOpts = new RedocNormalizedOptions(options); + if (normalizedOpts.nonce !== undefined) { + try { + __webpack_nonce__ = normalizedOpts.nonce; + } catch { } // If we have exception, Webpack was not used to run this. + } + return ( diff --git a/src/services/RedocNormalizedOptions.ts b/src/services/RedocNormalizedOptions.ts index 9d1c9ac6..3d5c65e7 100644 --- a/src/services/RedocNormalizedOptions.ts +++ b/src/services/RedocNormalizedOptions.ts @@ -54,6 +54,7 @@ export interface RedocRawOptions { ignoreNamedSchemas?: string[] | string; hideSchemaPattern?: boolean; generatedPayloadSamplesMaxDepth?: number; + nonce?: string; hideFab?: boolean; } @@ -251,6 +252,8 @@ export class RedocNormalizedOptions { generatedPayloadSamplesMaxDepth: number; hideFab: boolean; + nonce?: string; + constructor(raw: RedocRawOptions, defaults: RedocRawOptions = {}) { raw = { ...defaults, ...raw }; const hook = raw.theme && raw.theme.extensionsHook; @@ -320,6 +323,7 @@ export class RedocNormalizedOptions { RedocNormalizedOptions.normalizeGeneratedPayloadSamplesMaxDepth( raw.generatedPayloadSamplesMaxDepth, ); + this.nonce = raw.nonce; this.hideFab = argValueToBoolean(raw.hideFab); } } From 7dd76292e01c835000fdf70fc71d26c50fdd05fc Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Thu, 24 Mar 2022 08:53:19 +0200 Subject: [PATCH 12/43] chore: update snapshots for unit tests (#1942) --- .../__snapshots__/DiscriminatorDropdown.test.tsx.snap | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap index 5475840f..dd9d5e5e 100644 --- a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap @@ -91,6 +91,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, @@ -336,6 +337,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, @@ -557,6 +559,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, @@ -843,6 +846,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, @@ -1088,6 +1092,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, @@ -1309,6 +1314,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, @@ -1553,6 +1559,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, @@ -1836,6 +1843,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, @@ -2081,6 +2089,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, @@ -2302,6 +2311,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView "menuToggle": true, "nativeScrollbars": false, "noAutoAuth": false, + "nonce": undefined, "onlyRequiredInSamples": false, "pathInMiddlePanel": false, "payloadSampleIdx": 0, From d8916df30370b5efc65d379409e9b268230f55cc Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Thu, 24 Mar 2022 09:02:01 +0200 Subject: [PATCH 13/43] chore: update minimist for security reasons (#1943) --- cli/npm-shrinkwrap.json | 12 ++++++------ package-lock.json | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cli/npm-shrinkwrap.json b/cli/npm-shrinkwrap.json index 2803d823..8b554587 100644 --- a/cli/npm-shrinkwrap.json +++ b/cli/npm-shrinkwrap.json @@ -1707,9 +1707,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "node_modules/mkdirp": { "version": "1.0.4", @@ -4421,9 +4421,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "mkdirp": { "version": "1.0.4", diff --git a/package-lock.json b/package-lock.json index cd081921..3d2f8361 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13467,9 +13467,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "node_modules/minimist-options": { @@ -29254,9 +29254,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "minimist-options": { From de67df102a243fab95aaf0af9518d1bfeb857230 Mon Sep 17 00:00:00 2001 From: Sergey Dubovyk Date: Thu, 24 Mar 2022 15:46:03 +0100 Subject: [PATCH 14/43] chore: change side menu message (#1390) --- src/components/SideMenu/SideMenu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SideMenu/SideMenu.tsx b/src/components/SideMenu/SideMenu.tsx index 6e98a5c2..96747a94 100644 --- a/src/components/SideMenu/SideMenu.tsx +++ b/src/components/SideMenu/SideMenu.tsx @@ -25,8 +25,8 @@ export class SideMenu extends React.Component<{ menu: MenuStore; className?: str > - - Documentation Powered by ReDoc + + Documentation Powered by Redocly From 2b551e7bf1c34bc5d4116d5ce63ba8a6aeb4ab26 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Mar 2022 17:33:38 +0200 Subject: [PATCH 15/43] chore(deps): bump node-forge from 1.2.1 to 1.3.0 (#1944) Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.2.1 to 1.3.0. - [Release notes](https://github.com/digitalbazaar/forge/releases) - [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md) - [Commits](https://github.com/digitalbazaar/forge/compare/v1.2.1...v1.3.0) --- updated-dependencies: - dependency-name: node-forge dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d2f8361..f7bba2f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13754,9 +13754,9 @@ } }, "node_modules/node-forge": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.2.1.tgz", - "integrity": "sha512-Fcvtbb+zBcZXbTTVwqGA5W+MKBj56UjVRevvchv5XrcyXbmNdesfZL37nlcWOfpgHhgmxApw3tQbTr4CqNmX4w==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.0.tgz", + "integrity": "sha512-08ARB91bUi6zNKzVmaj3QO7cr397uiDT2nJ63cHjyNtCTWIgvS47j3eT0WfzUwS9+6Z5YshRaoasFkXCKrIYbA==", "dev": true, "engines": { "node": ">= 6.13.0" @@ -29456,9 +29456,9 @@ } }, "node-forge": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.2.1.tgz", - "integrity": "sha512-Fcvtbb+zBcZXbTTVwqGA5W+MKBj56UjVRevvchv5XrcyXbmNdesfZL37nlcWOfpgHhgmxApw3tQbTr4CqNmX4w==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.0.tgz", + "integrity": "sha512-08ARB91bUi6zNKzVmaj3QO7cr397uiDT2nJ63cHjyNtCTWIgvS47j3eT0WfzUwS9+6Z5YshRaoasFkXCKrIYbA==", "dev": true }, "node-int64": { From 61edf6c1b936a1e394b47eb25a9f65617ad2c6f2 Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Wed, 30 Mar 2022 14:20:40 +0300 Subject: [PATCH 16/43] chore: v2.0.0-rs.66 (#1949) --- CHANGELOG.md | 17 +++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f0575e1..83667a3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# [2.0.0-rc.66](https://github.com/Redocly/redoc/compare/v2.0.0-rc.65...v2.0.0-rc.66) (2022-03-30) + + +### Bug Fixes + +* add handle local files for serve command ([#1810](https://github.com/Redocly/redoc/issues/1810)) ([117071e](https://github.com/Redocly/redoc/commit/117071ee83a32d9b3350d8afe2bdb6365a44e2ec)) +* move comma out of code block in SecurityRequirement.tsx ([#1924](https://github.com/Redocly/redoc/issues/1924)) ([ab3e8a8](https://github.com/Redocly/redoc/commit/ab3e8a8f80f453066c5495e73ac932a8fef0830a)) +* rename bandle command and add deprecate notice ([#1935](https://github.com/Redocly/redoc/issues/1935)) ([eb096b6](https://github.com/Redocly/redoc/commit/eb096b69be52568fc581027161c7d0c4b26c56c1)) + + +### Features + +* add support for displaying operationId in the sidebar ([#1927](https://github.com/Redocly/redoc/issues/1927)) ([09786f2](https://github.com/Redocly/redoc/commit/09786f2a5ade6303ea00512483b172347721ca70)) +* add nonce support ([#1566](https://github.com/Redocly/redoc/issues/1566)) ([c75ac9c](https://github.com/Redocly/redoc/commit/c75ac9cf70012e2d539b379aab2f0974d088db07)) + + + # [2.0.0-rc.65](https://github.com/Redocly/redoc/compare/v2.0.0-rc.64...v2.0.0-rc.65) (2022-03-15) diff --git a/package-lock.json b/package-lock.json index f7bba2f2..866e57d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "redoc", - "version": "2.0.0-rc.65", + "version": "2.0.0-rc.66", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "redoc", - "version": "2.0.0-rc.65", + "version": "2.0.0-rc.66", "license": "MIT", "dependencies": { "@redocly/openapi-core": "^1.0.0-beta.88", diff --git a/package.json b/package.json index 23eabbd7..b67cce5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redoc", - "version": "2.0.0-rc.65", + "version": "2.0.0-rc.66", "description": "ReDoc", "repository": { "type": "git", From 84fa123987a88a026c30977e8ec9e15ccd6796c9 Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Wed, 30 Mar 2022 15:17:45 +0300 Subject: [PATCH 17/43] chore:cli-v0.13.10 (#1950) Co-authored-by: Ivana Isadora Devcic <33730345+skadinna@users.noreply.github.com> --- cli/README.md | 15 +++++++++------ cli/npm-shrinkwrap.json | 4 ++-- cli/package.json | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cli/README.md b/cli/README.md index bc6d8bcf..1d6537b6 100644 --- a/cli/README.md +++ b/cli/README.md @@ -12,20 +12,23 @@ or using [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runn The two following commands are available: - `redoc-cli serve [spec]` - starts the server with `spec` rendered with ReDoc. - Supports a server-side rendering mode (`--ssr`), - and can watch the spec (`--watch`) to automatically reload the page whenever it changes. -- `redoc-cli bundle [spec]` - bundles `spec` and ReDoc into a **zero-dependency** HTML file. + Supports a server-side rendering mode (`--ssr`) + and can watch the spec (`--watch`) to automatically reload the page whenever it changes.\ + Deprecated. Use `npx @redocly/openapi-cli preview-docs [spec]` +- `redoc-cli bundle [spec]` - bundles `spec` and Redoc into a **zero-dependency** HTML file.\ + Deprecated. Use Use "build" command instead. +- `redoc-cli build [spec]` - build `spec` and Redoc into a **zero-dependency** HTML file. Some examples: - Bundle with the main color changed to `orange`:
    - `$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange` + `$ redoc-cli build [spec] --options.theme.colors.primary.main=orange` - Serve with the `nativeScrollbars` option set to true:
    `$ redoc-cli serve [spec] --options.nativeScrollbars` - Bundle using a custom [Handlebars](https://handlebarsjs.com/) template (check the [default template](https://github.com/Redocly/redoc/blob/master/cli/template.hbs) for an example):
    - `$ redoc-cli bundle [spec] -t custom.hbs` + `$ redoc-cli build [spec] -t custom.hbs` - Bundle using a custom template and add custom `templateOptions`:
    - `$ redoc-cli bundle [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"` + `$ redoc-cli build [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"` For more details, run `redoc-cli --help`. diff --git a/cli/npm-shrinkwrap.json b/cli/npm-shrinkwrap.json index 8b554587..42fc91f5 100644 --- a/cli/npm-shrinkwrap.json +++ b/cli/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "redoc-cli", - "version": "0.13.9", + "version": "0.13.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "redoc-cli", - "version": "0.13.9", + "version": "0.13.10", "license": "MIT", "dependencies": { "chokidar": "^3.5.1", diff --git a/cli/package.json b/cli/package.json index ebc5e3b3..2aa95d34 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "redoc-cli", - "version": "0.13.9", + "version": "0.13.10", "description": "ReDoc's Command Line Interface", "main": "index.js", "bin": "index.js", From a160498089a44ebf540745b55fbaf18a54eb9d88 Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Wed, 30 Mar 2022 15:29:47 +0300 Subject: [PATCH 18/43] chore: update redoc version in cli (#1951) --- cli/npm-shrinkwrap.json | 54 ++++++++++++++++++++--------------------- cli/package.json | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cli/npm-shrinkwrap.json b/cli/npm-shrinkwrap.json index 42fc91f5..982b88e3 100644 --- a/cli/npm-shrinkwrap.json +++ b/cli/npm-shrinkwrap.json @@ -17,7 +17,7 @@ "node-libs-browser": "^2.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", - "redoc": "2.0.0-rc.65", + "redoc": "2.0.0-rc.66", "styled-components": "^5.3.0", "yargs": "^17.3.1" }, @@ -216,9 +216,9 @@ } }, "node_modules/@redocly/openapi-core": { - "version": "1.0.0-beta.80", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.80.tgz", - "integrity": "sha512-IAQECLt/fDxjlfNdLGnJszt40BaiA6b78+zB6+7Rk8ums0HHLfwWFJPMTzh1bzJ5f+sZ4zDBi4gaIJ1n4XGCHg==", + "version": "1.0.0-beta.91", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.91.tgz", + "integrity": "sha512-8RhZGn5jSoy3oZE0sAdXxhPPHrqKgy2JVJzLqjgX9LDjNf7cXOTYOXkXIkjv1tfZHFBV/H7c08rRLEdxnzn0dg==", "dependencies": { "@redocly/ajv": "^8.6.4", "@types/node": "^14.11.8", @@ -236,9 +236,9 @@ } }, "node_modules/@redocly/openapi-core/node_modules/@types/node": { - "version": "14.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.9.tgz", - "integrity": "sha512-j11XSuRuAlft6vLDEX4RvhqC0KxNxx6QIyMXNb0vHHSNPXTPeiy3algESWmOOIzEtiEL0qiowPU3ewW9hHVa7Q==" + "version": "14.18.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", + "integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A==" }, "node_modules/@redocly/react-dropdown-aria": { "version": "2.0.12", @@ -1696,9 +1696,9 @@ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2217,11 +2217,11 @@ } }, "node_modules/redoc": { - "version": "2.0.0-rc.65", - "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.65.tgz", - "integrity": "sha512-VqJbhb3krYXFP8De7ygyaWsA4jr9K5avsMo3GJUDv2xPiHTOzcprkIfOaL4ZdINn03x6JT1GOa47cWhrmb5KVA==", + "version": "2.0.0-rc.66", + "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.66.tgz", + "integrity": "sha512-ZjmZhYkg46QAkza4SYCouY3TEuqnkjf50uyJBiz6Dyaz55RLClofAKokPoy5uEBo0RkPjxebKf9HTGyrxNqJ8A==", "dependencies": { - "@redocly/openapi-core": "^1.0.0-beta.54", + "@redocly/openapi-core": "^1.0.0-beta.88", "@redocly/react-dropdown-aria": "^2.0.11", "classnames": "^2.3.1", "decko": "^1.2.0", @@ -3146,9 +3146,9 @@ } }, "@redocly/openapi-core": { - "version": "1.0.0-beta.80", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.80.tgz", - "integrity": "sha512-IAQECLt/fDxjlfNdLGnJszt40BaiA6b78+zB6+7Rk8ums0HHLfwWFJPMTzh1bzJ5f+sZ4zDBi4gaIJ1n4XGCHg==", + "version": "1.0.0-beta.91", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.91.tgz", + "integrity": "sha512-8RhZGn5jSoy3oZE0sAdXxhPPHrqKgy2JVJzLqjgX9LDjNf7cXOTYOXkXIkjv1tfZHFBV/H7c08rRLEdxnzn0dg==", "requires": { "@redocly/ajv": "^8.6.4", "@types/node": "^14.11.8", @@ -3163,9 +3163,9 @@ }, "dependencies": { "@types/node": { - "version": "14.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.9.tgz", - "integrity": "sha512-j11XSuRuAlft6vLDEX4RvhqC0KxNxx6QIyMXNb0vHHSNPXTPeiy3algESWmOOIzEtiEL0qiowPU3ewW9hHVa7Q==" + "version": "14.18.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", + "integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A==" } } }, @@ -4413,9 +4413,9 @@ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "requires": { "brace-expansion": "^1.1.7" } @@ -4822,11 +4822,11 @@ } }, "redoc": { - "version": "2.0.0-rc.65", - "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.65.tgz", - "integrity": "sha512-VqJbhb3krYXFP8De7ygyaWsA4jr9K5avsMo3GJUDv2xPiHTOzcprkIfOaL4ZdINn03x6JT1GOa47cWhrmb5KVA==", + "version": "2.0.0-rc.66", + "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.66.tgz", + "integrity": "sha512-ZjmZhYkg46QAkza4SYCouY3TEuqnkjf50uyJBiz6Dyaz55RLClofAKokPoy5uEBo0RkPjxebKf9HTGyrxNqJ8A==", "requires": { - "@redocly/openapi-core": "^1.0.0-beta.54", + "@redocly/openapi-core": "^1.0.0-beta.88", "@redocly/react-dropdown-aria": "^2.0.11", "classnames": "^2.3.1", "decko": "^1.2.0", diff --git a/cli/package.json b/cli/package.json index 2aa95d34..f475f461 100644 --- a/cli/package.json +++ b/cli/package.json @@ -19,7 +19,7 @@ "node-libs-browser": "^2.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", - "redoc": "2.0.0-rc.65", + "redoc": "2.0.0-rc.66", "styled-components": "^5.3.0", "yargs": "^17.3.1" }, From 6716b08e8871d95880e9f5a6c5491038002754e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20F=C3=BCrhoff?= Date: Thu, 7 Apr 2022 15:51:52 +0200 Subject: [PATCH 19/43] feat: theme add sidebar activeBackgroundColor and activeTextColor (#1600) --- README.md | 16 ++++++++++------ src/components/SideMenu/styled.elements.ts | 22 +++++++++------------- src/theme.ts | 10 +++++++++- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index bc5155a6..5b76db06 100644 --- a/README.md +++ b/README.md @@ -285,21 +285,25 @@ You can use all of the following options with the standalone version of the ({ } `; -function menuItemActiveBg(depth, { theme }: { theme: ResolvedThemeInterface }): string { + +function menuItemActive(depth, { theme }: { theme: ResolvedThemeInterface }, option: string): string { if (depth > 1) { - return darken(0.1, theme.sidebar.backgroundColor); + return theme.sidebar.level1Items[option]; } else if (depth === 1) { - return darken(0.05, theme.sidebar.backgroundColor); + return theme.sidebar.groupItems[option]; } else { return ''; } @@ -102,17 +103,10 @@ export const menuItemDepth = { font-size: 0.8em; padding-bottom: 0; cursor: default; - color: ${props => props.theme.sidebar.textColor}; `, 1: css` font-size: 0.929em; text-transform: ${({ theme }) => theme.sidebar.level1Items.textTransform}; - &:hover { - color: ${props => props.theme.sidebar.activeTextColor}; - } - `, - 2: css` - color: ${props => props.theme.sidebar.textColor}; `, }; @@ -131,7 +125,7 @@ export const MenuItemLabel = styled.label.attrs((props: MenuItemLabelType) => ({ }))` cursor: pointer; color: ${props => - props.active ? props.theme.sidebar.activeTextColor : props.theme.sidebar.textColor}; + props.active ? menuItemActive(props.depth, props, 'activeTextColor') : props.theme.sidebar.textColor}; margin: 0; padding: 12.5px ${props => props.theme.spacing.unit * 4}px; ${({ depth, type, theme }) => @@ -140,12 +134,14 @@ export const MenuItemLabel = styled.label.attrs((props: MenuItemLabelType) => ({ justify-content: space-between; font-family: ${props => props.theme.typography.headings.fontFamily}; ${props => menuItemDepth[props.depth]}; - background-color: ${props => (props.active ? menuItemActiveBg(props.depth, props) : '')}; + background-color: ${props => + props.active ? menuItemActive(props.depth, props, 'activeBackgroundColor') : props.theme.sidebar.backgroundColor}; ${props => (props.deprecated && deprecatedCss) || ''}; &:hover { - background-color: ${props => menuItemActiveBg(props.depth, props)}; + color: ${props => menuItemActive(props.depth, props, 'activeTextColor')}; + background-color: ${props => menuItemActive(props.depth, props, 'activeBackgroundColor')}; } ${ShelfIcon} { diff --git a/src/theme.ts b/src/theme.ts index 13f969b4..a0f03981 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -139,9 +139,13 @@ const defaultTheme: ThemeInterface = { ? theme.sidebar.textColor : theme.colors.primary.main, groupItems: { - textTransform: 'uppercase', + activeBackgroundColor: theme => darken(0.1, theme.sidebar.backgroundColor), + activeTextColor: theme => theme.sidebar.activeTextColor, + textTransform: 'uppercase' }, level1Items: { + activeBackgroundColor: theme => darken(0.05, theme.sidebar.backgroundColor), + activeTextColor: theme => theme.sidebar.activeTextColor, textTransform: 'none', }, arrow: { @@ -319,9 +323,13 @@ export interface ResolvedThemeInterface { textColor: string; activeTextColor: string; groupItems: { + activeBackgroundColor: string; + activeTextColor: string; textTransform: string; }; level1Items: { + activeBackgroundColor: string; + activeTextColor: string; textTransform: string; }; arrow: { From 1e80dd69a3687d2f97d070104126d17950222ff8 Mon Sep 17 00:00:00 2001 From: Anastasiia Date: Mon, 11 Apr 2022 10:40:30 +0300 Subject: [PATCH 20/43] fix: update snapshot (#1956) --- .../DiscriminatorDropdown.test.tsx.snap | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap index dd9d5e5e..9a16b531 100644 --- a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap @@ -224,9 +224,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", @@ -470,9 +474,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", @@ -692,9 +700,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", @@ -979,9 +991,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", @@ -1225,9 +1241,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", @@ -1447,9 +1467,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", @@ -1692,9 +1716,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", @@ -1976,9 +2004,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", @@ -2222,9 +2254,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", @@ -2444,9 +2480,13 @@ exports[`Components SchemaView discriminator should correctly render SchemaView }, "backgroundColor": "#fafafa", "groupItems": Object { + "activeBackgroundColor": "#e1e1e1", + "activeTextColor": "#32329f", "textTransform": "uppercase", }, "level1Items": Object { + "activeBackgroundColor": "#ededed", + "activeTextColor": "#32329f", "textTransform": "none", }, "textColor": "#333333", From fd8917e5c109840c1bfa4c2c0902b6dcec200286 Mon Sep 17 00:00:00 2001 From: Ben Blowers Date: Tue, 12 Apr 2022 10:19:15 +0100 Subject: [PATCH 21/43] fix: prefix operation ids with parent id (#1245) Co-authored-by: ben.blowers Co-authored-by: anastasiia-developer --- e2e/integration/menu.e2e.ts | 2 +- e2e/integration/misc.e2e.ts | 8 ++++---- e2e/integration/urls.e2e.ts | 19 +++++++++++++++++++ src/components/Operation/Operation.tsx | 3 ++- src/services/models/Operation.ts | 4 +++- 5 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 e2e/integration/urls.e2e.ts diff --git a/e2e/integration/menu.e2e.ts b/e2e/integration/menu.e2e.ts index b3b4090a..d958b589 100644 --- a/e2e/integration/menu.e2e.ts +++ b/e2e/integration/menu.e2e.ts @@ -49,7 +49,7 @@ describe('Menu', () => { cy.location('hash').should('equal', '#tag/pet'); cy.contains('[role=menuitem]', 'Find pet by ID').click({ force: true }); - cy.location('hash').should('equal', '#operation/getPetById'); + cy.location('hash').should('equal', '#tag/pet/operation/getPetById'); }); it('should deactivate tag when other is activated', () => { diff --git a/e2e/integration/misc.e2e.ts b/e2e/integration/misc.e2e.ts index 6466bca4..a6fa129a 100644 --- a/e2e/integration/misc.e2e.ts +++ b/e2e/integration/misc.e2e.ts @@ -21,12 +21,12 @@ describe('Servers', () => { initReDoc(win, spec, {}); // TODO add cy-data attributes - cy.get('[data-section-id="operation/addPet"]').should( + cy.get('[data-section-id="tag/pet/operation/addPet"]').should( 'contain', 'http://petstore.swagger.io/v2/pet', ); - cy.get('[data-section-id="operation/addPet"]').should( + cy.get('[data-section-id="tag/pet/operation/addPet"]').should( 'contain', 'http://petstore.swagger.io/sandbox/pet', ); @@ -40,7 +40,7 @@ describe('Servers', () => { initReDoc(win, spec, {}); // TODO add cy-data attributes - cy.get('[data-section-id="operation/addPet"]').should( + cy.get('[data-section-id="tag/pet/operation/addPet"]').should( 'contain', 'http://localhost:' + win.location.port + '/pet', ); @@ -55,7 +55,7 @@ describe('Servers', () => { initReDoc(win, spec, {}); // TODO add cy-data attributes - cy.get('[data-section-id="operation/addPet"]').should( + cy.get('[data-section-id="tag/pet/operation/addPet"]').should( 'contain', 'http://localhost:' + win.location.port + '/pet', ); diff --git a/e2e/integration/urls.e2e.ts b/e2e/integration/urls.e2e.ts new file mode 100644 index 00000000..9db718f0 --- /dev/null +++ b/e2e/integration/urls.e2e.ts @@ -0,0 +1,19 @@ +describe('Supporting both operation/* and parent/*/operation* urls', () => { + beforeEach(() => { + cy.visit('e2e/standalone.html'); + }); + + it('should supporting operation/* url', () => { + cy.url().then(loc => { + cy.visit(loc + '#operation/updatePet'); + cy.get('li[data-item-id="tag/pet/operation/updatePet"]').should('be.visible'); + }); + }); + + it('should supporting parent/*/operation url', () => { + cy.url().then(loc => { + cy.visit(loc + '#tag/pet/operation/addPet'); + cy.get('li[data-item-id="tag/pet/operation/addPet"]').should('be.visible'); + }); + }); +}); diff --git a/src/components/Operation/Operation.tsx b/src/components/Operation/Operation.tsx index cae98266..8170351e 100644 --- a/src/components/Operation/Operation.tsx +++ b/src/components/Operation/Operation.tsx @@ -17,6 +17,7 @@ import { RequestSamples } from '../RequestSamples/RequestSamples'; import { ResponsesList } from '../Responses/ResponsesList'; import { ResponseSamples } from '../ResponseSamples/ResponseSamples'; import { SecurityRequirements } from '../SecurityRequirement/SecurityRequirement'; +import { SECTION_ATTR } from '../../services'; const Description = styled.div` margin-bottom: ${({ theme }) => theme.spacing.unit * 6}px; @@ -37,7 +38,7 @@ export class Operation extends React.Component { return ( {options => ( - +

    diff --git a/src/services/models/Operation.ts b/src/services/models/Operation.ts index be9c683b..502846f3 100644 --- a/src/services/models/Operation.ts +++ b/src/services/models/Operation.ts @@ -70,6 +70,7 @@ export class OperationModel implements IMenuItem { pointer: string; operationId?: string; + operationHash?: string; httpVerb: string; deprecated: boolean; path: string; @@ -123,9 +124,10 @@ export class OperationModel implements IMenuItem { // TODO: update getting pathInfo for overriding servers on path level this.servers = normalizeServers('', operationSpec.servers || operationSpec.pathServers || []); } else { + this.operationHash = operationSpec.operationId && 'operation/' + operationSpec.operationId this.id = operationSpec.operationId !== undefined - ? 'operation/' + operationSpec.operationId + ? (parent ? parent.id + '/' : '') + this.operationHash : parent !== undefined ? parent.id + this.pointer : this.pointer; From 8f7e56c747d88be5c5eb5c4bbaee0ff69e9cb2ec Mon Sep 17 00:00:00 2001 From: Andrey Lomakin Date: Fri, 15 Apr 2022 16:53:36 +0300 Subject: [PATCH 22/43] fix: issue with navigation when operationId contains backslash or quotes (#1513) Co-authored-by: Andrey Lomakin Co-authored-by: Anastasiia Derymarko Co-authored-by: Andriy Zaleskyy --- demo/openapi-3-1.yaml | 32 ++++++++++++------- e2e/integration/menu.e2e.ts | 16 ++++++++++ src/common-elements/linkify.tsx | 2 +- src/services/MenuStore.ts | 12 +++---- .../loadAndBundleSpec.test.ts.snap | 14 ++++++++ src/utils/helpers.ts | 7 +++- 6 files changed, 64 insertions(+), 19 deletions(-) diff --git a/demo/openapi-3-1.yaml b/demo/openapi-3-1.yaml index ac89619d..707033cf 100644 --- a/demo/openapi-3-1.yaml +++ b/demo/openapi-3-1.yaml @@ -93,7 +93,7 @@ paths: parameters: - name: Accept-Language in: header - description: "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US" + description: 'The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US' example: en-US required: false schema: @@ -182,6 +182,16 @@ paths: } requestBody: $ref: '#/components/requestBodies/Pet' + delete: + tags: + - pet + summary: OperationId with quotes + operationId: deletePetBy"Id + get: + tags: + - pet + summary: OperationId with backslash + operationId: delete\PetById '/pet/{petId}': get: tags: @@ -259,7 +269,7 @@ paths: required: false schema: type: string - example: "Bearer " + example: 'Bearer ' - name: petId in: path description: Pet id to delete @@ -432,7 +442,7 @@ paths: application/json: example: status: 400 - message: "Invalid Order" + message: 'Invalid Order' requestBody: content: application/json: @@ -894,11 +904,11 @@ paths: type: string examples: response: - value: OK + value: OK text/plain: examples: response: - value: OK + value: OK '400': description: Invalid username/password supplied /user/logout: @@ -925,7 +935,7 @@ components: content: multipart/form-data: schema: - $ref: "#/components/schemas/Cat" + $ref: '#/components/schemas/Cat' responses: '200': description: update Cat details @@ -940,7 +950,7 @@ components: content: multipart/form-data: schema: - $ref: "#/components/schemas/Cat" + $ref: '#/components/schemas/Cat' responses: '200': description: create Cat details @@ -1073,8 +1083,8 @@ components: properties: id: externalDocs: - description: "Find more info here" - url: "https://example.com" + description: 'Find more info here' + url: 'https://example.com' description: Pet ID $ref: '#/components/schemas/Id' category: @@ -1251,9 +1261,9 @@ webhooks: content: application/json: schema: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' responses: - "200": + '200': description: Return a 200 status to indicate that the data was received successfully myWebhook: $ref: '#/components/pathItems/webhooks' diff --git a/e2e/integration/menu.e2e.ts b/e2e/integration/menu.e2e.ts index d958b589..22212e16 100644 --- a/e2e/integration/menu.e2e.ts +++ b/e2e/integration/menu.e2e.ts @@ -76,4 +76,20 @@ describe('Menu', () => { .then($h5 => $h5[0].firstChild!.nodeValue!.trim()) .should('eq', 'Response Schema:'); }); + + it('should be able to open the operation details when the operation IDs have quotes', () => { + cy.visit('e2e/standalone-3-1.html'); + cy.get('label span[title="pet"]').click({ multiple: true, force: true }); + cy.get('li').contains('OperationId with quotes').click({ multiple: true, force: true }); + cy.get('h2').contains('OperationId with quotes').should('be.visible'); + cy.url().should('include', 'deletePetBy%22Id'); + }); + + it.only('should encode URL when the operation IDs have backslashes', () => { + cy.visit('e2e/standalone-3-1.html'); + cy.get('label span[title="pet"]').click({ multiple: true, force: true }); + cy.get('li').contains('OperationId with backslash').click({ multiple: true, force: true }); + cy.get('h2').contains('OperationId with backslash').should('be.visible'); + cy.url().should('include', 'delete%5CPetById'); + }); }); diff --git a/src/common-elements/linkify.tsx b/src/common-elements/linkify.tsx index 4ace029e..bbbf2f06 100644 --- a/src/common-elements/linkify.tsx +++ b/src/common-elements/linkify.tsx @@ -67,7 +67,7 @@ function navigate(history: HistoryService, event: React.MouseEvent SECURITY_SCHEMES_SECTION_PREFIX.startsWith(i.id)); this.activateAndScroll(item, false); } - this.scroll.scrollIntoViewBySelector(`[${SECTION_ATTR}="${id}"]`); + this.scroll.scrollIntoViewBySelector(`[${SECTION_ATTR}="${escapeHTMLAttrChars(id)}"]`); } }; @@ -163,7 +163,7 @@ export class MenuStore { */ getElementAt(idx: number): Element | null { const item = this.flatItems[idx]; - return (item && querySelector(`[${SECTION_ATTR}="${item.id}"]`)) || null; + return (item && querySelector(`[${SECTION_ATTR}="${escapeHTMLAttrChars(item.id)}"]`)) || null; } /** @@ -175,7 +175,7 @@ export class MenuStore { if (item && item.type === 'group') { item = item.items[0]; } - return (item && querySelector(`[${SECTION_ATTR}="${item.id}"]`)) || null; + return (item && querySelector(`[${SECTION_ATTR}="${escapeHTMLAttrChars(item.id)}"]`)) || null; } /** @@ -224,7 +224,7 @@ export class MenuStore { this.activeItemIdx = item.absoluteIdx!; if (updateLocation) { - this.history.replace(item.id, rewriteHistory); + this.history.replace(encodeURI(item.id), rewriteHistory); } item.activate(); diff --git a/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap b/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap index 6cd0a034..4ae0cd33 100644 --- a/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap +++ b/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap @@ -2330,6 +2330,20 @@ and standard method from web, mobile and desktop applications. "openapi": "3.1.0", "paths": Object { "/pet": Object { + "delete": Object { + "operationId": "deletePetBy\\"Id", + "summary": "OperationId with quotes", + "tags": Array [ + "pet", + ], + }, + "get": Object { + "operationId": "delete\\\\PetById", + "summary": "OperationId with backslash", + "tags": Array [ + "pet", + ], + }, "parameters": Array [ Object { "description": "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US", diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 32a5956f..2b7ea8e8 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -195,8 +195,13 @@ function parseURL(url: string) { } } +export function escapeHTMLAttrChars(str: string): string { + return str.replace(/["\\]/g, '\\$&'); +} + export function unescapeHTMLChars(str: string): string { return str .replace(/&#(\d+);/g, (_m, code) => String.fromCharCode(parseInt(code, 10))) - .replace(/&/g, '&'); + .replace(/&/g, '&') + .replace(/"/g, '"'); } From 8240404a552bf538c5b171542037dfef06ffbdcf Mon Sep 17 00:00:00 2001 From: Oprysk Vyacheslav Date: Mon, 18 Apr 2022 23:46:08 +0300 Subject: [PATCH 23/43] chore: codeowners --- .github/CODEOWNERS | 2 ++ package.json | 4 ++-- src/components/RedocStandalone.tsx | 7 ++++--- src/components/SideMenu/styled.elements.ts | 15 +++++++++++---- src/services/models/Operation.ts | 2 +- src/services/models/SecurityRequirement.ts | 2 +- src/theme.ts | 2 +- 7 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..bfeb0d2c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +* @Redocly/keyboard-warriors +/docs/ @Redocly/technical-writers \ No newline at end of file diff --git a/package.json b/package.json index b67cce5f..49f1263a 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "start": "webpack serve --mode=development --env playground --hot --config demo/webpack.config.ts", "start:prod": "webpack serve --env playground --mode=production --config demo/webpack.config.ts", "start:benchmark": "webpack serve --mode=production --env.bench --config demo/webpack.config.ts", - "test": "npm run lint && npm run unit && npm run license-check", + "test": "npm run unit && npm run license-check", "unit": "jest --coverage", "e2e": "cypress run", "e2e-ci": "cypress run --record", @@ -49,7 +49,7 @@ "stats": "webpack --env production --env standalone --json --profile --mode=production > stats.json", "prettier": "prettier --write \"cli/index.ts\" \"src/**/*.{ts,tsx}\"", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1", - "lint": "eslint 'src/**/*.{js,ts,tsx}' --cache", + "lint": "eslint --fix 'src/**/*.{js,ts,tsx}' --cache", "benchmark": "node ./benchmark/benchmark.js", "start:demo": "webpack serve --hot --config demo/webpack.config.ts --mode=development", "compile:cli": "tsc custom.d.ts cli/index.ts --target es6 --module commonjs --types yargs", diff --git a/src/components/RedocStandalone.tsx b/src/components/RedocStandalone.tsx index fe3c67e2..24ea13e0 100644 --- a/src/components/RedocStandalone.tsx +++ b/src/components/RedocStandalone.tsx @@ -26,9 +26,10 @@ export const RedocStandalone = function (props: RedocStandaloneProps) { const normalizedOpts = new RedocNormalizedOptions(options); if (normalizedOpts.nonce !== undefined) { - try { - __webpack_nonce__ = normalizedOpts.nonce; - } catch { } // If we have exception, Webpack was not used to run this. + try { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + __webpack_nonce__ = normalizedOpts.nonce; + } catch {} // If we have exception, Webpack was not used to run this. } return ( diff --git a/src/components/SideMenu/styled.elements.ts b/src/components/SideMenu/styled.elements.ts index e4d94179..abc9f15e 100644 --- a/src/components/SideMenu/styled.elements.ts +++ b/src/components/SideMenu/styled.elements.ts @@ -66,8 +66,11 @@ export const OperationBadge = styled.span.attrs((props: { type: string }) => ({ } `; - -function menuItemActive(depth, { theme }: { theme: ResolvedThemeInterface }, option: string): string { +function menuItemActive( + depth, + { theme }: { theme: ResolvedThemeInterface }, + option: string, +): string { if (depth > 1) { return theme.sidebar.level1Items[option]; } else if (depth === 1) { @@ -125,7 +128,9 @@ export const MenuItemLabel = styled.label.attrs((props: MenuItemLabelType) => ({ }))` cursor: pointer; color: ${props => - props.active ? menuItemActive(props.depth, props, 'activeTextColor') : props.theme.sidebar.textColor}; + props.active + ? menuItemActive(props.depth, props, 'activeTextColor') + : props.theme.sidebar.textColor}; margin: 0; padding: 12.5px ${props => props.theme.spacing.unit * 4}px; ${({ depth, type, theme }) => @@ -135,7 +140,9 @@ export const MenuItemLabel = styled.label.attrs((props: MenuItemLabelType) => ({ font-family: ${props => props.theme.typography.headings.fontFamily}; ${props => menuItemDepth[props.depth]}; background-color: ${props => - props.active ? menuItemActive(props.depth, props, 'activeBackgroundColor') : props.theme.sidebar.backgroundColor}; + props.active + ? menuItemActive(props.depth, props, 'activeBackgroundColor') + : props.theme.sidebar.backgroundColor}; ${props => (props.deprecated && deprecatedCss) || ''}; diff --git a/src/services/models/Operation.ts b/src/services/models/Operation.ts index 502846f3..2b3f6213 100644 --- a/src/services/models/Operation.ts +++ b/src/services/models/Operation.ts @@ -124,7 +124,7 @@ export class OperationModel implements IMenuItem { // TODO: update getting pathInfo for overriding servers on path level this.servers = normalizeServers('', operationSpec.servers || operationSpec.pathServers || []); } else { - this.operationHash = operationSpec.operationId && 'operation/' + operationSpec.operationId + this.operationHash = operationSpec.operationId && 'operation/' + operationSpec.operationId; this.id = operationSpec.operationId !== undefined ? (parent ? parent.id + '/' : '') + this.operationHash diff --git a/src/services/models/SecurityRequirement.ts b/src/services/models/SecurityRequirement.ts index 9ec1ae2a..8525f499 100644 --- a/src/services/models/SecurityRequirement.ts +++ b/src/services/models/SecurityRequirement.ts @@ -25,7 +25,7 @@ export class SecurityRequirementModel { return undefined; } const displayName = scheme['x-displayName'] || id; - + return { ...scheme, id, diff --git a/src/theme.ts b/src/theme.ts index a0f03981..e8f2bf2e 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -141,7 +141,7 @@ const defaultTheme: ThemeInterface = { groupItems: { activeBackgroundColor: theme => darken(0.1, theme.sidebar.backgroundColor), activeTextColor: theme => theme.sidebar.activeTextColor, - textTransform: 'uppercase' + textTransform: 'uppercase', }, level1Items: { activeBackgroundColor: theme => darken(0.05, theme.sidebar.backgroundColor), From 2ca8e081baea6996eb01b5df27b8cd88331d5c96 Mon Sep 17 00:00:00 2001 From: AvroraPolnareff <46288303+AvroraPolnareff@users.noreply.github.com> Date: Tue, 26 Apr 2022 13:36:14 +0300 Subject: [PATCH 24/43] fix: Expand/Collapse all buttons disappears for flat structures (#1424) Co-authored-by: AvroraPolnareff Co-authored-by: Roman Hotsiy Co-authored-by: anastasiia-developer --- src/components/JsonViewer/JsonViewer.tsx | 52 ++++++++++++++---------- src/components/__tests__/JsonViewer.tsx | 8 ++++ 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/src/components/JsonViewer/JsonViewer.tsx b/src/components/JsonViewer/JsonViewer.tsx index 2bcfc146..8464765f 100644 --- a/src/components/JsonViewer/JsonViewer.tsx +++ b/src/components/JsonViewer/JsonViewer.tsx @@ -26,27 +26,37 @@ class Json extends React.PureComponent { return {this.renderInner}; } - renderInner = ({ renderCopyButton }) => ( - - - {renderCopyButton()} - - - - - {options => ( - (this.node = node!)} - dangerouslySetInnerHTML={{ - __html: jsonToHTML(this.props.data, options.jsonSampleExpandLevel), - }} - /> - )} - - - ); + renderInner = ({ renderCopyButton }) => { + const showFoldingButtons = this.props.data && Object.values(this.props.data).some( + (value) => typeof value === 'object' && value !== null, + ); + + return ( + + + {renderCopyButton()} + {showFoldingButtons && + <> + + + + } + + + {options => ( + (this.node = node!)} + dangerouslySetInnerHTML={{ + __html: jsonToHTML(this.props.data, options.jsonSampleExpandLevel), + }} + /> + )} + + + ); + }; expandAll = () => { const elements = this.node.getElementsByClassName('collapsible'); diff --git a/src/components/__tests__/JsonViewer.tsx b/src/components/__tests__/JsonViewer.tsx index 8649c14d..35b5d179 100644 --- a/src/components/__tests__/JsonViewer.tsx +++ b/src/components/__tests__/JsonViewer.tsx @@ -42,5 +42,13 @@ describe('Components', () => { expect(ClipboardService.copySelected as jest.Mock).toHaveBeenCalled(); }); + + test('Expand/Collapse buttons disappears for flat structures', () => { + const flatData = { a: 1, b: '2', c: null }; + const flatDataComponent = mount(withTheme()); + + expect(flatDataComponent.html()).not.toContain('Expand all'); + expect(flatDataComponent.html()).not.toContain('Collapse all'); + }); }); }); From 88e250e0539dcc48ec399017223c36d1f6cf8a40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Apr 2022 10:26:36 +0300 Subject: [PATCH 25/43] chore(deps): bump async from 2.6.3 to 2.6.4 (#1964) Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4. - [Release notes](https://github.com/caolan/async/releases) - [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md) - [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4) --- updated-dependencies: - dependency-name: async dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 866e57d0..2b33fea6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4054,9 +4054,9 @@ } }, "node_modules/async": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", - "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", "dev": true }, "node_modules/asynckit": { @@ -14598,9 +14598,9 @@ } }, "node_modules/portfinder/node_modules/async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "dependencies": { "lodash": "^4.17.14" @@ -22152,9 +22152,9 @@ "dev": true }, "async": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", - "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", "dev": true }, "asynckit": { @@ -30101,9 +30101,9 @@ }, "dependencies": { "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "requires": { "lodash": "^4.17.14" From aba2d1ad2d8dda9f52055c36ebde1323457dfd3e Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Wed, 27 Apr 2022 11:19:07 +0300 Subject: [PATCH 26/43] fix: improve markdown render with CRLF (#1953) --- src/services/MarkdownRenderer.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/MarkdownRenderer.ts b/src/services/MarkdownRenderer.ts index d64ff00a..08b5e692 100644 --- a/src/services/MarkdownRenderer.ts +++ b/src/services/MarkdownRenderer.ts @@ -101,7 +101,9 @@ export class MarkdownRenderer { attachHeadingsDescriptions(rawText: string) { const buildRegexp = (heading: MarkdownHeading) => { - return new RegExp(`##?\\s+${heading.name.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}\s*\n`); + return new RegExp( + `##?\\s+${heading.name.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}\s*(\n|\r\n)`, + ); }; const flatHeadings = this.flattenHeadings(this.headings); From 90f71c0d77719871910cfba883a32ad131bef059 Mon Sep 17 00:00:00 2001 From: Draon con Color Date: Wed, 27 Apr 2022 17:40:44 +0200 Subject: [PATCH 27/43] feat: add optional BASE_PATH to Docker config (#1378) Co-authored-by: draoncc <14227820+draoncc@users.noreply.github.com> Co-authored-by: anastasiia-developer --- config/docker/Dockerfile | 1 + config/docker/README.md | 3 ++- config/docker/docker-run.sh | 1 + config/docker/index.tpl.html | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/docker/Dockerfile b/config/docker/Dockerfile index 94e1762d..55e5d0a9 100644 --- a/config/docker/Dockerfile +++ b/config/docker/Dockerfile @@ -26,6 +26,7 @@ FROM nginx:alpine ENV PAGE_TITLE="ReDoc" ENV PAGE_FAVICON="favicon.png" +ENV BASE_PATH= ENV SPEC_URL="http://petstore.swagger.io/v2/swagger.json" ENV PORT=80 ENV REDOC_OPTIONS= diff --git a/config/docker/README.md b/config/docker/README.md index b25f41bd..8e042f4a 100644 --- a/config/docker/README.md +++ b/config/docker/README.md @@ -45,9 +45,10 @@ Another issue with OpenShift is that the default exposed port `80` cannot be use - `PAGE_TITLE` (default `"ReDoc"`) - page title - `PAGE_FAVICON` (default `"favicon.png"`) - URL to page favicon +- `BASE_PATH` (optional) - prepend favicon & standalone bundle with this path - `SPEC_URL` (default `"http://petstore.swagger.io/v2/swagger.json"`) - URL to spec - `PORT` (default `80`) - nginx port -- `REDOC_OPTIONS` - [`` tag attributes](https://github.com/Redocly/redoc#redoc-tag-attributes) +- `REDOC_OPTIONS` (optional) - [`` tag attributes](https://github.com/Redocly/redoc#redoc-tag-attributes) ## Build diff --git a/config/docker/docker-run.sh b/config/docker/docker-run.sh index 2706b243..f9c69e0c 100644 --- a/config/docker/docker-run.sh +++ b/config/docker/docker-run.sh @@ -4,6 +4,7 @@ set -e sed -i -e "s|%PAGE_TITLE%|$PAGE_TITLE|g" /usr/share/nginx/html/index.html sed -i -e "s|%PAGE_FAVICON%|$PAGE_FAVICON|g" /usr/share/nginx/html/index.html +sed -i -e "s|%BASE_PATH%|$BASE_PATH|g" /usr/share/nginx/html/index.html sed -i -e "s|%SPEC_URL%|$SPEC_URL|g" /usr/share/nginx/html/index.html sed -i -e "s|%REDOC_OPTIONS%|${REDOC_OPTIONS}|g" /usr/share/nginx/html/index.html sed -i -e "s|\(listen\s*\) [0-9]*|\1 ${PORT}|g" /etc/nginx/nginx.conf diff --git a/config/docker/index.tpl.html b/config/docker/index.tpl.html index 15171edc..83258786 100644 --- a/config/docker/index.tpl.html +++ b/config/docker/index.tpl.html @@ -4,7 +4,7 @@ %PAGE_TITLE% - +