feat: expose plugins and presets on SwaggerUI global symbol (#9189)
Part of this commit is also: - complete plugins consolidation - complete presets consolidation - build system consolidation Refs #9188
This commit is contained in:
10
.browserslistrc
Normal file
10
.browserslistrc
Normal file
@@ -0,0 +1,10 @@
|
||||
[production]
|
||||
> 1%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
not dead
|
||||
|
||||
[development]
|
||||
last 1 chrome version
|
||||
last 1 firefox version
|
||||
last 1 safari version
|
||||
178
babel.config.js
178
babel.config.js
@@ -1,74 +1,14 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"commonjs": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"debug": false,
|
||||
"modules": "commonjs",
|
||||
"targets": {
|
||||
"node": "8"
|
||||
},
|
||||
"forceAllTransforms": false,
|
||||
"ignoreBrowserslistConfig": true
|
||||
}
|
||||
],
|
||||
"@babel/preset-react",
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@babel/plugin-transform-modules-commonjs",
|
||||
{
|
||||
"loose": true
|
||||
}
|
||||
],
|
||||
"@babel/proposal-class-properties",
|
||||
"@babel/proposal-object-rest-spread",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
]
|
||||
},
|
||||
"es": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"debug": false,
|
||||
"modules": false
|
||||
}
|
||||
],
|
||||
"@babel/preset-react",
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@babel/plugin-transform-runtime",
|
||||
{
|
||||
"absoluteRuntime": false,
|
||||
"corejs": 3,
|
||||
"version": "^7.11.2"
|
||||
}
|
||||
],
|
||||
"@babel/proposal-class-properties",
|
||||
"@babel/proposal-object-rest-spread",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
]
|
||||
},
|
||||
"development": {
|
||||
"esm": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/env",
|
||||
{
|
||||
"targets": {
|
||||
"browsers": [
|
||||
/* benefit of C/S/FF/Edge only? */
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"Firefox ESR",
|
||||
"not dead"
|
||||
]
|
||||
},
|
||||
"debug": true,
|
||||
"modules": false,
|
||||
"ignoreBrowserslistConfig": false,
|
||||
"useBuiltIns": false,
|
||||
"corejs": { version: 3 },
|
||||
"include": [
|
||||
"@babel/plugin-proposal-logical-assignment-operators"
|
||||
]
|
||||
@@ -85,8 +25,6 @@ module.exports = {
|
||||
"version": "^7.11.2"
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
[
|
||||
"transform-react-remove-prop-types",
|
||||
{
|
||||
@@ -100,13 +38,7 @@ module.exports = {
|
||||
{
|
||||
"alias": {
|
||||
"root": ".",
|
||||
"components": "./src/core/components",
|
||||
"containers": "./src/core/containers",
|
||||
"core": "./src/core",
|
||||
"plugins": "./src/plugins",
|
||||
"img": "./src/img",
|
||||
"corePlugins": "./src/core/plugins",
|
||||
"less": "./src/less"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -118,10 +50,10 @@ module.exports = {
|
||||
"@babel/env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "10"
|
||||
"node": "16.13.2"
|
||||
},
|
||||
"ignoreBrowserslistConfig": true,
|
||||
"useBuiltIns": false,
|
||||
"corejs": { version: 3 }
|
||||
}
|
||||
],
|
||||
"@babel/preset-react"
|
||||
@@ -135,8 +67,6 @@ module.exports = {
|
||||
"version": "^7.11.2"
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
[
|
||||
"transform-react-remove-prop-types",
|
||||
{
|
||||
@@ -150,18 +80,100 @@ module.exports = {
|
||||
{
|
||||
"alias": {
|
||||
"root": ".",
|
||||
"components": "./src/core/components",
|
||||
"containers": "./src/core/containers",
|
||||
"core": "./src/core",
|
||||
"plugins": "./src/plugins",
|
||||
"img": "./src/img",
|
||||
"corePlugins": "./src/core/plugins",
|
||||
"less": "./src/less"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"development": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/env",
|
||||
{
|
||||
"ignoreBrowserslistConfig": false,
|
||||
"useBuiltIns": false,
|
||||
"include": [
|
||||
"@babel/plugin-proposal-logical-assignment-operators"
|
||||
]
|
||||
}
|
||||
],
|
||||
"@babel/preset-react"
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@babel/plugin-transform-runtime",
|
||||
{
|
||||
"corejs": 3,
|
||||
"absoluteRuntime": false,
|
||||
"version": "^7.11.2"
|
||||
}
|
||||
],
|
||||
[
|
||||
"transform-react-remove-prop-types",
|
||||
{
|
||||
"additionalLibraries": [
|
||||
"react-immutable-proptypes"
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"babel-plugin-module-resolver",
|
||||
{
|
||||
"alias": {
|
||||
"root": ".",
|
||||
"core": "./src/core",
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"production": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/env",
|
||||
{
|
||||
"ignoreBrowserslistConfig": false,
|
||||
"useBuiltIns": false,
|
||||
"include": [
|
||||
"@babel/plugin-proposal-logical-assignment-operators"
|
||||
]
|
||||
}
|
||||
],
|
||||
"@babel/preset-react"
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-transform-class-properties",
|
||||
"@babel/plugin-transform-nullish-coalescing-operator",
|
||||
"@babel/plugin-transform-object-rest-spread",
|
||||
"@babel/plugin-transform-optional-chaining",
|
||||
[
|
||||
"@babel/plugin-transform-runtime",
|
||||
{
|
||||
"corejs": 3,
|
||||
"absoluteRuntime": false,
|
||||
"version": "^7.11.2"
|
||||
}
|
||||
],
|
||||
[
|
||||
"transform-react-remove-prop-types",
|
||||
{
|
||||
"additionalLibraries": [
|
||||
"react-immutable-proptypes"
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"babel-plugin-module-resolver",
|
||||
{
|
||||
"alias": {
|
||||
"root": ".",
|
||||
"core": "./src/core",
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ module.exports = {
|
||||
'<rootDir>/test/unit/components/online-validator-badge.jsx',
|
||||
'<rootDir>/test/unit/components/live-response.jsx',
|
||||
],
|
||||
moduleNameMapper: {
|
||||
'^.+\\.svg$': 'jest-transform-stub'
|
||||
},
|
||||
transformIgnorePatterns: ['/node_modules/(?!(sinon)/)'],
|
||||
silent: true, // set to `false` to allow console.* calls to be printed
|
||||
};
|
||||
|
||||
27309
dist/swagger-ui-es-bundle-core.js
vendored
27309
dist/swagger-ui-es-bundle-core.js
vendored
File diff suppressed because one or more lines are too long
@@ -17,6 +17,8 @@ Welcome to the Swagger UI documentation!
|
||||
- [Overview](customization/overview.md)
|
||||
- [Plugin API](customization/plugin-api.md)
|
||||
- [Custom layout](customization/custom-layout.md)
|
||||
- [Adding plugin](customization/add-plugin.md)
|
||||
- [Plug-Points](customization/plug-points.md)
|
||||
|
||||
## Development
|
||||
|
||||
|
||||
206
package-lock.json
generated
206
package-lock.json
generated
@@ -51,11 +51,10 @@
|
||||
"@babel/cli": "=7.22.10",
|
||||
"@babel/core": "=7.22.11",
|
||||
"@babel/eslint-parser": "=7.22.11",
|
||||
"@babel/plugin-proposal-class-properties": "=7.18.6",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "=7.18.6",
|
||||
"@babel/plugin-proposal-object-rest-spread": "=7.20.7",
|
||||
"@babel/plugin-proposal-optional-chaining": "=7.21.0",
|
||||
"@babel/plugin-transform-modules-commonjs": "=7.22.11",
|
||||
"@babel/plugin-transform-class-properties": "=7.22.5",
|
||||
"@babel/plugin-transform-nullish-coalescing-operator": "=7.22.11",
|
||||
"@babel/plugin-transform-object-rest-spread": "=7.22.15",
|
||||
"@babel/plugin-transform-optional-chaining": "=7.22.15",
|
||||
"@babel/plugin-transform-runtime": "=7.22.10",
|
||||
"@babel/preset-env": "=7.22.14",
|
||||
"@babel/preset-react": "=7.22.5",
|
||||
@@ -96,6 +95,7 @@
|
||||
"inspectpack": "=4.7.1",
|
||||
"jest": "=29.6.3",
|
||||
"jest-environment-jsdom": "=29.6.4",
|
||||
"jest-transform-stub": "=2.0.0",
|
||||
"jsdom": "=22.1.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"json-merger": "^1.1.10",
|
||||
@@ -309,13 +309,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-compilation-targets": {
|
||||
"version": "7.22.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.10.tgz",
|
||||
"integrity": "sha512-JMSwHD4J7SLod0idLq5PKgI+6g/hLD/iuWBq08ZX49xE14VpVEojJ5rHWptpirV2j020MvypRLAXAO50igCJ5Q==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz",
|
||||
"integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.22.9",
|
||||
"@babel/helper-validator-option": "^7.22.5",
|
||||
"@babel/helper-validator-option": "^7.22.15",
|
||||
"browserslist": "^4.21.9",
|
||||
"lru-cache": "^5.1.1",
|
||||
"semver": "^6.3.1"
|
||||
@@ -567,9 +567,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-validator-option": {
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz",
|
||||
"integrity": "sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz",
|
||||
"integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -661,74 +661,6 @@
|
||||
"@babel/core": "^7.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-class-properties": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz",
|
||||
"integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-create-class-features-plugin": "^7.18.6",
|
||||
"@babel/helper-plugin-utils": "^7.18.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-nullish-coalescing-operator": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz",
|
||||
"integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.18.6",
|
||||
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-object-rest-spread": {
|
||||
"version": "7.20.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz",
|
||||
"integrity": "sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.20.5",
|
||||
"@babel/helper-compilation-targets": "^7.20.7",
|
||||
"@babel/helper-plugin-utils": "^7.20.2",
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
|
||||
"@babel/plugin-transform-parameters": "^7.20.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-optional-chaining": {
|
||||
"version": "7.21.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz",
|
||||
"integrity": "sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.20.2",
|
||||
"@babel/helper-skip-transparent-expression-wrappers": "^7.20.0",
|
||||
"@babel/plugin-syntax-optional-chaining": "^7.8.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-private-property-in-object": {
|
||||
"version": "7.21.0-placeholder-for-preset-env.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz",
|
||||
@@ -1489,16 +1421,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-object-rest-spread": {
|
||||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.22.11.tgz",
|
||||
"integrity": "sha512-nX8cPFa6+UmbepISvlf5jhQyaC7ASs/7UxHmMkuJ/k5xSHvDPPaibMo+v3TXwU/Pjqhep/nFNpd3zn4YR59pnw==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.22.15.tgz",
|
||||
"integrity": "sha512-fEB+I1+gAmfAyxZcX1+ZUwLeAuuf8VIg67CTznZE0MqVFumWkh8xWtn58I4dxdVf080wn7gzWoF8vndOViJe9Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.22.9",
|
||||
"@babel/helper-compilation-targets": "^7.22.10",
|
||||
"@babel/helper-compilation-targets": "^7.22.15",
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
|
||||
"@babel/plugin-transform-parameters": "^7.22.5"
|
||||
"@babel/plugin-transform-parameters": "^7.22.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -1540,9 +1472,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-optional-chaining": {
|
||||
"version": "7.22.12",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.22.12.tgz",
|
||||
"integrity": "sha512-7XXCVqZtyFWqjDsYDY4T45w4mlx1rf7aOgkc/Ww76xkgBiOlmjPkx36PBLHa1k1rwWvVgYMPsbuVnIamx2ZQJw==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.22.15.tgz",
|
||||
"integrity": "sha512-ngQ2tBhq5vvSJw2Q2Z9i7ealNkpDMU0rGWnHPKqRZO0tzZ5tlaoz4hDvhXioOoaE0X2vfNss1djwg0DXlfu30A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -1557,9 +1489,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-parameters": {
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.22.5.tgz",
|
||||
"integrity": "sha512-AVkFUBurORBREOmHRKo06FjHYgjrabpdqRSwq6+C7R5iTCZOsM4QbcB27St0a4U6fffyAOqh3s/qEfybAhfivg==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.22.15.tgz",
|
||||
"integrity": "sha512-hjk7qKIqhyzhhUvRT683TYQOFa/4cQKwQy7ALvTpODswN40MljzNDa0YldevS6tGbxwaEKVn502JmY0dP7qEtQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -17312,6 +17244,12 @@
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/jest-transform-stub": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-transform-stub/-/jest-transform-stub-2.0.0.tgz",
|
||||
"integrity": "sha512-lspHaCRx/mBbnm3h4uMMS3R5aZzMwyNpNIJLXj4cEsV0mIUtS4IjYJLSoyjRCtnxb6RIGJ4NL2quZzfIeNhbkg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/jest-util": {
|
||||
"version": "29.6.3",
|
||||
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.3.tgz",
|
||||
@@ -30129,13 +30067,13 @@
|
||||
}
|
||||
},
|
||||
"@babel/helper-compilation-targets": {
|
||||
"version": "7.22.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.10.tgz",
|
||||
"integrity": "sha512-JMSwHD4J7SLod0idLq5PKgI+6g/hLD/iuWBq08ZX49xE14VpVEojJ5rHWptpirV2j020MvypRLAXAO50igCJ5Q==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz",
|
||||
"integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/compat-data": "^7.22.9",
|
||||
"@babel/helper-validator-option": "^7.22.5",
|
||||
"@babel/helper-validator-option": "^7.22.15",
|
||||
"browserslist": "^4.21.9",
|
||||
"lru-cache": "^5.1.1",
|
||||
"semver": "^6.3.1"
|
||||
@@ -30315,9 +30253,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@babel/helper-validator-option": {
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz",
|
||||
"integrity": "sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz",
|
||||
"integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==",
|
||||
"dev": true
|
||||
},
|
||||
"@babel/helper-wrap-function": {
|
||||
@@ -30379,50 +30317,6 @@
|
||||
"@babel/plugin-transform-optional-chaining": "^7.22.5"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-proposal-class-properties": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz",
|
||||
"integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-create-class-features-plugin": "^7.18.6",
|
||||
"@babel/helper-plugin-utils": "^7.18.6"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz",
|
||||
"integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.18.6",
|
||||
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-proposal-object-rest-spread": {
|
||||
"version": "7.20.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz",
|
||||
"integrity": "sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/compat-data": "^7.20.5",
|
||||
"@babel/helper-compilation-targets": "^7.20.7",
|
||||
"@babel/helper-plugin-utils": "^7.20.2",
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
|
||||
"@babel/plugin-transform-parameters": "^7.20.7"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-proposal-optional-chaining": {
|
||||
"version": "7.21.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz",
|
||||
"integrity": "sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.20.2",
|
||||
"@babel/helper-skip-transparent-expression-wrappers": "^7.20.0",
|
||||
"@babel/plugin-syntax-optional-chaining": "^7.8.3"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-proposal-private-property-in-object": {
|
||||
"version": "7.21.0-placeholder-for-preset-env.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz",
|
||||
@@ -30917,16 +30811,16 @@
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-object-rest-spread": {
|
||||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.22.11.tgz",
|
||||
"integrity": "sha512-nX8cPFa6+UmbepISvlf5jhQyaC7ASs/7UxHmMkuJ/k5xSHvDPPaibMo+v3TXwU/Pjqhep/nFNpd3zn4YR59pnw==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.22.15.tgz",
|
||||
"integrity": "sha512-fEB+I1+gAmfAyxZcX1+ZUwLeAuuf8VIg67CTznZE0MqVFumWkh8xWtn58I4dxdVf080wn7gzWoF8vndOViJe9Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/compat-data": "^7.22.9",
|
||||
"@babel/helper-compilation-targets": "^7.22.10",
|
||||
"@babel/helper-compilation-targets": "^7.22.15",
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
|
||||
"@babel/plugin-transform-parameters": "^7.22.5"
|
||||
"@babel/plugin-transform-parameters": "^7.22.15"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-object-super": {
|
||||
@@ -30950,9 +30844,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-optional-chaining": {
|
||||
"version": "7.22.12",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.22.12.tgz",
|
||||
"integrity": "sha512-7XXCVqZtyFWqjDsYDY4T45w4mlx1rf7aOgkc/Ww76xkgBiOlmjPkx36PBLHa1k1rwWvVgYMPsbuVnIamx2ZQJw==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.22.15.tgz",
|
||||
"integrity": "sha512-ngQ2tBhq5vvSJw2Q2Z9i7ealNkpDMU0rGWnHPKqRZO0tzZ5tlaoz4hDvhXioOoaE0X2vfNss1djwg0DXlfu30A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -30961,9 +30855,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-parameters": {
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.22.5.tgz",
|
||||
"integrity": "sha512-AVkFUBurORBREOmHRKo06FjHYgjrabpdqRSwq6+C7R5iTCZOsM4QbcB27St0a4U6fffyAOqh3s/qEfybAhfivg==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.22.15.tgz",
|
||||
"integrity": "sha512-hjk7qKIqhyzhhUvRT683TYQOFa/4cQKwQy7ALvTpODswN40MljzNDa0YldevS6tGbxwaEKVn502JmY0dP7qEtQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -42495,6 +42389,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"jest-transform-stub": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-transform-stub/-/jest-transform-stub-2.0.0.tgz",
|
||||
"integrity": "sha512-lspHaCRx/mBbnm3h4uMMS3R5aZzMwyNpNIJLXj4cEsV0mIUtS4IjYJLSoyjRCtnxb6RIGJ4NL2quZzfIeNhbkg==",
|
||||
"dev": true
|
||||
},
|
||||
"jest-util": {
|
||||
"version": "29.6.3",
|
||||
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.3.tgz",
|
||||
|
||||
34
package.json
34
package.json
@@ -39,28 +39,28 @@
|
||||
"automated-release": "release-it -VV --config ./release/.release-it.json",
|
||||
"build": "npm run build-stylesheets && rimraf ./dist/swagger-ui.js ./dist/swagger-ui.js.map && npm run build-all-bundles",
|
||||
"build-all-bundles": "run-p --aggregate-output build:core build:bundle build:standalone build:es:bundle build:es:bundle:core",
|
||||
"build-stylesheets": "webpack --color --config webpack/stylesheets.babel.js",
|
||||
"build:bundle": "webpack --color --config webpack/bundle.babel.js",
|
||||
"build:core": "webpack --color --config webpack/core.babel.js",
|
||||
"build:standalone": "webpack --color --config webpack/standalone.babel.js",
|
||||
"build:es:bundle": "webpack --color --config webpack/es-bundle.babel.js",
|
||||
"build:es:bundle:core": "webpack --color --config webpack/es-bundle-core.babel.js",
|
||||
"build-stylesheets": "cross-env NODE_ENV=production webpack --color --config webpack/stylesheets.js",
|
||||
"build:bundle": "cross-env NODE_ENV=production webpack --color --config webpack/bundle.js",
|
||||
"build:core": "cross-env NODE_ENV=production webpack --color --config webpack/core.js",
|
||||
"build:standalone": "cross-env NODE_ENV=production webpack --color --config webpack/standalone.js",
|
||||
"build:es:bundle": "cross-env NODE_ENV=production webpack --color --config webpack/es-bundle.js",
|
||||
"build:es:bundle:core": "cross-env NODE_ENV=production BABEL_ENV=esm webpack --color --config webpack/es-bundle-core.js",
|
||||
"clean": "rimraf ./dist",
|
||||
"postinstall": "patch-package",
|
||||
"dev": "webpack serve --config webpack/dev.babel.js",
|
||||
"dev": "cross-env NODE_ENV=development webpack serve --config webpack/dev.js",
|
||||
"deps-license": "license-checker --production --csv --out $npm_package_config_deps_check_dir/licenses.csv && license-checker --development --csv --out $npm_package_config_deps_check_dir/licenses-dev.csv",
|
||||
"deps-size": "webpack -p --config webpack/bundle.babel.js --json | webpack-bundle-size-analyzer >| $npm_package_config_deps_check_dir/sizes.txt",
|
||||
"deps-size": "cross-env NODE_ENV=development webpack -p --config webpack/bundle.js --json | webpack-bundle-size-analyzer >| $npm_package_config_deps_check_dir/sizes.txt",
|
||||
"deps-check": "run-s deps-license deps-size",
|
||||
"lint": "eslint --ext \".js,.jsx\" src test dev-helpers flavors",
|
||||
"lint-errors": "eslint --quiet --ext \".js,.jsx\" src test dev-helpers flavors",
|
||||
"lint-fix": "eslint --ext \".js,.jsx\" src test dev-helpers flavors --fix",
|
||||
"test": "run-s lint-errors just-test-in-node test:unit-jest cy:ci",
|
||||
"test-in-node": "run-s lint-errors just-test-in-node",
|
||||
"just-test-in-node": "cross-env BABEL_ENV=test mocha \"test/mocha/**/*.{js,jsx}\"",
|
||||
"test:artifact": "jest --config ./config/jest/jest.artifact.config.js",
|
||||
"test:unit-jest": "cross-env BABEL_ENV=test jest --config ./config/jest/jest.unit.config.js",
|
||||
"just-test-in-node": "cross-env NODE_ENV=test mocha \"test/mocha/**/*.{js,jsx}\"",
|
||||
"test:artifact": "cross-env NODE_ENV=production jest --config ./config/jest/jest.artifact.config.js",
|
||||
"test:unit-jest": "cross-env NODE_ENV=test jest --config ./config/jest/jest.unit.config.js",
|
||||
"cy:mock-api": "json-server --watch test/e2e-selenium/db.json --port 3204",
|
||||
"cy:server": "webpack serve --config webpack/dev-e2e.babel.js",
|
||||
"cy:server": "cross-env NODE_ENV=production webpack serve --config webpack/dev-e2e.js",
|
||||
"cy:start": "run-p -r cy:server cy:mock-api",
|
||||
"cy:open": "cypress open",
|
||||
"cy:run": "cypress run",
|
||||
@@ -115,11 +115,10 @@
|
||||
"@babel/cli": "=7.22.10",
|
||||
"@babel/core": "=7.22.11",
|
||||
"@babel/eslint-parser": "=7.22.11",
|
||||
"@babel/plugin-proposal-class-properties": "=7.18.6",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "=7.18.6",
|
||||
"@babel/plugin-proposal-object-rest-spread": "=7.20.7",
|
||||
"@babel/plugin-proposal-optional-chaining": "=7.21.0",
|
||||
"@babel/plugin-transform-modules-commonjs": "=7.22.11",
|
||||
"@babel/plugin-transform-class-properties": "=7.22.5",
|
||||
"@babel/plugin-transform-nullish-coalescing-operator": "=7.22.11",
|
||||
"@babel/plugin-transform-object-rest-spread": "=7.22.15",
|
||||
"@babel/plugin-transform-optional-chaining": "=7.22.15",
|
||||
"@babel/plugin-transform-runtime": "=7.22.10",
|
||||
"@babel/preset-env": "=7.22.14",
|
||||
"@babel/preset-react": "=7.22.5",
|
||||
@@ -160,6 +159,7 @@
|
||||
"inspectpack": "=4.7.1",
|
||||
"jest": "=29.6.3",
|
||||
"jest-environment-jsdom": "=29.6.4",
|
||||
"jest-transform-stub": "=2.0.0",
|
||||
"jsdom": "=22.1.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"json-merger": "^1.1.10",
|
||||
|
||||
|
Before Width: | Height: | Size: 734 B After Width: | Height: | Size: 734 B |
@@ -1,6 +0,0 @@
|
||||
/* global ace */
|
||||
ace.define("ace/snippets/yaml",
|
||||
["require","exports","module"], function(e,t,n){ // eslint-disable-line no-unused-vars
|
||||
t.snippetText=undefined
|
||||
t.scope="yaml"
|
||||
})
|
||||
@@ -3,6 +3,8 @@ import ImmutablePureComponent from "react-immutable-pure-component"
|
||||
import ImPropTypes from "react-immutable-proptypes"
|
||||
import PropTypes from "prop-types"
|
||||
|
||||
import RollingLoadSVG from "core/assets/rolling-load.svg"
|
||||
|
||||
const decodeRefName = uri => {
|
||||
const unescaped = uri.replace(/~1/g, "/").replace(/~0/g, "~")
|
||||
|
||||
@@ -66,7 +68,7 @@ export default class Model extends ImmutablePureComponent {
|
||||
if(!schema) {
|
||||
return <span className="model model-title">
|
||||
<span className="model-title__text">{ displayName || name }</span>
|
||||
<img src={require("core/../img/rolling-load.svg")} height={"20px"} width={"20px"} />
|
||||
<img src={RollingLoadSVG} height={"20px"} width={"20px"} />
|
||||
</span>
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { safeBuildUrl } from "core/utils/url"
|
||||
import { Iterable, List } from "immutable"
|
||||
import ImPropTypes from "react-immutable-proptypes"
|
||||
|
||||
import RollingLoadSVG from "core/assets/rolling-load.svg"
|
||||
|
||||
export default class Operation extends PureComponent {
|
||||
static propTypes = {
|
||||
@@ -122,7 +123,7 @@ export default class Operation extends PureComponent {
|
||||
<Collapse isOpened={isShown}>
|
||||
<div className="opblock-body">
|
||||
{ (operation && operation.size) || operation === null ? null :
|
||||
<img height={"32px"} width={"32px"} src={require("core/../img/rolling-load.svg")} className="opblock-loading-animation" />
|
||||
<img height={"32px"} width={"32px"} src={RollingLoadSVG} className="opblock-loading-animation" />
|
||||
}
|
||||
{ deprecated && <h4 className="opblock-title_normal"> Warning: Deprecated</h4>}
|
||||
{ description &&
|
||||
@@ -140,7 +141,7 @@ export default class Operation extends PureComponent {
|
||||
{externalDocs.description &&
|
||||
<span className="opblock-external-docs__description">
|
||||
<Markdown source={ externalDocs.description } />
|
||||
</span>
|
||||
</span>
|
||||
}
|
||||
<Link target="_blank" className="opblock-external-docs__link" href={sanitizeUrl(externalDocsUrl)}>{externalDocsUrl}</Link>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@ import PropTypes from "prop-types"
|
||||
import ImPropTypes from "react-immutable-proptypes"
|
||||
import win from "core/window"
|
||||
import { getExtensions, getCommonExtensions, numberToString, stringify, isEmptyValue } from "core/utils"
|
||||
import getParameterSchema from "../../helpers/get-parameter-schema.js"
|
||||
import getParameterSchema from "core/utils/get-parameter-schema.js"
|
||||
|
||||
export default class ParameterRow extends Component {
|
||||
static propTypes = {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { fromJS, Iterable } from "immutable"
|
||||
import PropTypes from "prop-types"
|
||||
import ImPropTypes from "react-immutable-proptypes"
|
||||
import { defaultStatusCode, getAcceptControllingResponse } from "core/utils"
|
||||
import createHtmlReadyId from "../../helpers/create-html-ready-id"
|
||||
import createHtmlReadyId from "core/utils/create-html-ready-id"
|
||||
|
||||
export default class Responses extends React.Component {
|
||||
static propTypes = {
|
||||
|
||||
@@ -1,8 +1,31 @@
|
||||
import deepExtend from "deep-extend"
|
||||
|
||||
import System from "./system"
|
||||
// presets
|
||||
import BasePreset from "./presets/base"
|
||||
import ApisPreset from "./presets/apis"
|
||||
import AllPlugins from "./plugins/all"
|
||||
// plugins
|
||||
import AuthPlugin from "./plugins/auth/"
|
||||
import ConfigsPlugin from "./plugins/configs"
|
||||
import DeepLinkingPlugin from "./plugins/deep-linking"
|
||||
import ErrPlugin from "./plugins/err"
|
||||
import FilterPlugin from "./plugins/filter"
|
||||
import IconsPlugin from "./plugins/icons"
|
||||
import JSONSchema202012Plugin from "./plugins/json-schema-2020-12"
|
||||
import LayoutPlugin from "./plugins/layout"
|
||||
import LogsPlugin from "./plugins/logs"
|
||||
import OpenAPI30Plugin from "./plugins/oas3"
|
||||
import OpenAPI31Plugin from "./plugins/oas3"
|
||||
import OnCompletePlugin from "./plugins/on-complete"
|
||||
import RequestSnippetsPlugin from "./plugins/request-snippets"
|
||||
import SamplesPlugin from "./plugins/samples"
|
||||
import SpecPlugin from "./plugins/spec"
|
||||
import SwaggerClientPlugin from "./plugins/swagger-client"
|
||||
import UtilPlugin from "./plugins/util"
|
||||
import ViewPlugin from "./plugins/view"
|
||||
import DownloadUrlPlugin from "./plugins/download-url"
|
||||
import SafeRenderPlugin from "./plugins/safe-render"
|
||||
|
||||
import { parseSearch } from "./utils"
|
||||
import win from "./window"
|
||||
|
||||
@@ -216,10 +239,30 @@ export default function SwaggerUI(opts) {
|
||||
return system
|
||||
}
|
||||
|
||||
// Add presets
|
||||
SwaggerUI.presets = {
|
||||
base: BasePreset,
|
||||
apis: ApisPreset,
|
||||
}
|
||||
|
||||
// All Plugins
|
||||
SwaggerUI.plugins = AllPlugins
|
||||
SwaggerUI.plugins = {
|
||||
Auth: AuthPlugin,
|
||||
Configs: ConfigsPlugin,
|
||||
DeepLining: DeepLinkingPlugin,
|
||||
Err: ErrPlugin,
|
||||
Filter: FilterPlugin,
|
||||
Icons: IconsPlugin,
|
||||
JSONSchema202012: JSONSchema202012Plugin,
|
||||
Layout: LayoutPlugin,
|
||||
Logs: LogsPlugin,
|
||||
OpenAPI30: OpenAPI30Plugin,
|
||||
OpenAPI31: OpenAPI31Plugin,
|
||||
OnComplete: OnCompletePlugin,
|
||||
RequestSnippets: RequestSnippetsPlugin,
|
||||
Samples: SamplesPlugin,
|
||||
Spec: SpecPlugin,
|
||||
SwaggerClient: SwaggerClientPlugin,
|
||||
Util: UtilPlugin,
|
||||
View: ViewPlugin,
|
||||
DownloadUrl: DownloadUrlPlugin,
|
||||
SafeRender: SafeRenderPlugin,
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { pascalCaseFilename } from "core/utils"
|
||||
import SafeRender from "core/plugins/safe-render"
|
||||
|
||||
const request = require.context(".", true, /\.jsx?$/)
|
||||
|
||||
const allPlugins = {}
|
||||
|
||||
export default allPlugins
|
||||
|
||||
request.keys().forEach( function( key ){
|
||||
if( key === "./index.js" ) {
|
||||
return
|
||||
}
|
||||
|
||||
// if( key.slice(2).indexOf("/") > -1) {
|
||||
// // skip files in subdirs
|
||||
// return
|
||||
// }
|
||||
|
||||
let mod = request(key)
|
||||
allPlugins[pascalCaseFilename(key)] = mod.default ? mod.default : mod
|
||||
})
|
||||
|
||||
allPlugins.SafeRender = SafeRender
|
||||
@@ -1,110 +0,0 @@
|
||||
import { createSelector } from "reselect"
|
||||
import { Map } from "immutable"
|
||||
import win from "../window"
|
||||
|
||||
export default function downloadUrlPlugin (toolbox) {
|
||||
let { fn } = toolbox
|
||||
|
||||
const actions = {
|
||||
download: (url)=> ({ errActions, specSelectors, specActions, getConfigs }) => {
|
||||
let { fetch } = fn
|
||||
const config = getConfigs()
|
||||
url = url || specSelectors.url()
|
||||
specActions.updateLoadingStatus("loading")
|
||||
errActions.clear({source: "fetch"})
|
||||
fetch({
|
||||
url,
|
||||
loadSpec: true,
|
||||
requestInterceptor: config.requestInterceptor || (a => a),
|
||||
responseInterceptor: config.responseInterceptor || (a => a),
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
"Accept": "application/json,*/*"
|
||||
}
|
||||
}).then(next,next)
|
||||
|
||||
function next(res) {
|
||||
if(res instanceof Error || res.status >= 400) {
|
||||
specActions.updateLoadingStatus("failed")
|
||||
errActions.newThrownErr(Object.assign( new Error((res.message || res.statusText) + " " + url), {source: "fetch"}))
|
||||
// Check if the failure was possibly due to CORS or mixed content
|
||||
if (!res.status && res instanceof Error) checkPossibleFailReasons()
|
||||
return
|
||||
}
|
||||
specActions.updateLoadingStatus("success")
|
||||
specActions.updateSpec(res.text)
|
||||
if(specSelectors.url() !== url) {
|
||||
specActions.updateUrl(url)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPossibleFailReasons() {
|
||||
try {
|
||||
let specUrl
|
||||
|
||||
if("URL" in win ) {
|
||||
specUrl = new URL(url)
|
||||
} else {
|
||||
// legacy browser, use <a href> to parse the URL
|
||||
specUrl = document.createElement("a")
|
||||
specUrl.href = url
|
||||
}
|
||||
|
||||
if(specUrl.protocol !== "https:" && win.location.protocol === "https:") {
|
||||
const error = Object.assign(
|
||||
new Error(`Possible mixed-content issue? The page was loaded over https:// but a ${specUrl.protocol}// URL was specified. Check that you are not attempting to load mixed content.`),
|
||||
{source: "fetch"}
|
||||
)
|
||||
errActions.newThrownErr(error)
|
||||
return
|
||||
}
|
||||
if(specUrl.origin !== win.location.origin) {
|
||||
const error = Object.assign(
|
||||
new Error(`Possible cross-origin (CORS) issue? The URL origin (${specUrl.origin}) does not match the page (${win.location.origin}). Check the server returns the correct 'Access-Control-Allow-*' headers.`),
|
||||
{source: "fetch"}
|
||||
)
|
||||
errActions.newThrownErr(error)
|
||||
}
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
updateLoadingStatus: (status) => {
|
||||
let enums = [null, "loading", "failed", "success", "failedConfig"]
|
||||
if(enums.indexOf(status) === -1) {
|
||||
console.error(`Error: ${status} is not one of ${JSON.stringify(enums)}`)
|
||||
}
|
||||
|
||||
return {
|
||||
type: "spec_update_loading_status",
|
||||
payload: status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let reducers = {
|
||||
"spec_update_loading_status": (state, action) => {
|
||||
return (typeof action.payload === "string")
|
||||
? state.set("loadingStatus", action.payload)
|
||||
: state
|
||||
}
|
||||
}
|
||||
|
||||
let selectors = {
|
||||
loadingStatus: createSelector(
|
||||
state => {
|
||||
return state || Map()
|
||||
},
|
||||
spec => spec.get("loadingStatus") || null
|
||||
)
|
||||
}
|
||||
|
||||
return {
|
||||
statePlugins: {
|
||||
spec: { actions, reducers, selectors }
|
||||
}
|
||||
}
|
||||
}
|
||||
126
src/core/plugins/download-url/index.js
Normal file
126
src/core/plugins/download-url/index.js
Normal file
@@ -0,0 +1,126 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import { createSelector } from "reselect"
|
||||
import { Map } from "immutable"
|
||||
import win from "core/window"
|
||||
|
||||
export default function downloadUrlPlugin(toolbox) {
|
||||
let { fn } = toolbox
|
||||
|
||||
const actions = {
|
||||
download:
|
||||
(url) =>
|
||||
({ errActions, specSelectors, specActions, getConfigs }) => {
|
||||
let { fetch } = fn
|
||||
const config = getConfigs()
|
||||
url = url || specSelectors.url()
|
||||
specActions.updateLoadingStatus("loading")
|
||||
errActions.clear({ source: "fetch" })
|
||||
fetch({
|
||||
url,
|
||||
loadSpec: true,
|
||||
requestInterceptor: config.requestInterceptor || ((a) => a),
|
||||
responseInterceptor: config.responseInterceptor || ((a) => a),
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
Accept: "application/json,*/*",
|
||||
},
|
||||
}).then(next, next)
|
||||
|
||||
function next(res) {
|
||||
if (res instanceof Error || res.status >= 400) {
|
||||
specActions.updateLoadingStatus("failed")
|
||||
errActions.newThrownErr(
|
||||
Object.assign(
|
||||
new Error((res.message || res.statusText) + " " + url),
|
||||
{ source: "fetch" }
|
||||
)
|
||||
)
|
||||
// Check if the failure was possibly due to CORS or mixed content
|
||||
if (!res.status && res instanceof Error) checkPossibleFailReasons()
|
||||
return
|
||||
}
|
||||
specActions.updateLoadingStatus("success")
|
||||
specActions.updateSpec(res.text)
|
||||
if (specSelectors.url() !== url) {
|
||||
specActions.updateUrl(url)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPossibleFailReasons() {
|
||||
try {
|
||||
let specUrl
|
||||
|
||||
if ("URL" in win) {
|
||||
specUrl = new URL(url)
|
||||
} else {
|
||||
// legacy browser, use <a href> to parse the URL
|
||||
specUrl = document.createElement("a")
|
||||
specUrl.href = url
|
||||
}
|
||||
|
||||
if (
|
||||
specUrl.protocol !== "https:" &&
|
||||
win.location.protocol === "https:"
|
||||
) {
|
||||
const error = Object.assign(
|
||||
new Error(
|
||||
`Possible mixed-content issue? The page was loaded over https:// but a ${specUrl.protocol}// URL was specified. Check that you are not attempting to load mixed content.`
|
||||
),
|
||||
{ source: "fetch" }
|
||||
)
|
||||
errActions.newThrownErr(error)
|
||||
return
|
||||
}
|
||||
if (specUrl.origin !== win.location.origin) {
|
||||
const error = Object.assign(
|
||||
new Error(
|
||||
`Possible cross-origin (CORS) issue? The URL origin (${specUrl.origin}) does not match the page (${win.location.origin}). Check the server returns the correct 'Access-Control-Allow-*' headers.`
|
||||
),
|
||||
{ source: "fetch" }
|
||||
)
|
||||
errActions.newThrownErr(error)
|
||||
}
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
updateLoadingStatus: (status) => {
|
||||
let enums = [null, "loading", "failed", "success", "failedConfig"]
|
||||
if (enums.indexOf(status) === -1) {
|
||||
console.error(`Error: ${status} is not one of ${JSON.stringify(enums)}`)
|
||||
}
|
||||
|
||||
return {
|
||||
type: "spec_update_loading_status",
|
||||
payload: status,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
let reducers = {
|
||||
spec_update_loading_status: (state, action) => {
|
||||
return typeof action.payload === "string"
|
||||
? state.set("loadingStatus", action.payload)
|
||||
: state
|
||||
},
|
||||
}
|
||||
|
||||
let selectors = {
|
||||
loadingStatus: createSelector(
|
||||
(state) => {
|
||||
return state || Map()
|
||||
},
|
||||
(spec) => spec.get("loadingStatus") || null
|
||||
),
|
||||
}
|
||||
|
||||
return {
|
||||
statePlugins: {
|
||||
spec: { actions, reducers, selectors },
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import isEmpty from "lodash/isEmpty"
|
||||
import isPlainObject from "lodash/isPlainObject"
|
||||
|
||||
import { objectify, normalizeArray } from "core/utils"
|
||||
import memoizeN from "../../../../../helpers/memoizeN"
|
||||
import memoizeN from "core/utils/memoizeN"
|
||||
import typeMap from "./types/index"
|
||||
import { getType } from "./core/type"
|
||||
import { typeCast } from "./core/utils"
|
||||
|
||||
@@ -5,7 +5,7 @@ import { OrderedMap, Map, List } from "immutable"
|
||||
import { createSelector } from "reselect"
|
||||
|
||||
import { getDefaultRequestBodyValue } from "./components/request-body"
|
||||
import { stringify } from "../../utils"
|
||||
import { stringify } from "core/utils"
|
||||
|
||||
// Helpers
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import win from "../../window"
|
||||
import { Map } from "immutable"
|
||||
import win from "../../window"
|
||||
|
||||
|
||||
/**
|
||||
* if duplicate key name existed from FormData entries,
|
||||
|
||||
@@ -2,8 +2,7 @@ import XML from "xml"
|
||||
import RandExp from "randexp"
|
||||
import isEmpty from "lodash/isEmpty"
|
||||
import { objectify, isFunc, normalizeArray, deeplyStripKey } from "core/utils"
|
||||
|
||||
import memoizeN from "../../../../helpers/memoizeN"
|
||||
import memoizeN from "core/utils/memoizeN"
|
||||
|
||||
const generateStringFromRegex = (pattern) => {
|
||||
try {
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import reducers from "./reducers"
|
||||
import * as actions from "./actions"
|
||||
import * as selectors from "./selectors"
|
||||
import * as wrapActions from "./wrap-actions"
|
||||
|
||||
export default function() {
|
||||
return {
|
||||
statePlugins: {
|
||||
spec: {
|
||||
wrapActions,
|
||||
reducers,
|
||||
actions,
|
||||
selectors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const SpecPlugin = () => ({
|
||||
statePlugins: {
|
||||
spec: {
|
||||
wrapActions: { ...wrapActions },
|
||||
reducers: { ...reducers },
|
||||
actions: { ...actions },
|
||||
selectors: { ...selectors },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export default SpecPlugin
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { fromJS, List } from "immutable"
|
||||
import { fromJSOrdered, validateParam, paramToValue } from "core/utils"
|
||||
import win from "../../window"
|
||||
import { fromJSOrdered, validateParam, paramToValue, paramToIdentifier } from "core/utils"
|
||||
import win from "core/window"
|
||||
|
||||
// selector-in-reducer is suboptimal, but `operationWithMeta` is more of a helper
|
||||
import {
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
CLEAR_VALIDATE_PARAMS,
|
||||
SET_SCHEME
|
||||
} from "./actions"
|
||||
import { paramToIdentifier } from "../../utils"
|
||||
|
||||
export default {
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { createSelector } from "reselect"
|
||||
import { sorters } from "core/utils"
|
||||
import { sorters, paramToIdentifier } from "core/utils"
|
||||
import { fromJS, Set, Map, OrderedMap, List } from "immutable"
|
||||
import { paramToIdentifier } from "../../utils"
|
||||
|
||||
const DEFAULT_TAG = "default"
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { memoize } from "core/utils"
|
||||
|
||||
import memoizeN from "core/utils/memoizeN"
|
||||
import { getComponent, render, withMappedContainer } from "./root-injects"
|
||||
import { getDisplayName } from "./fn"
|
||||
import memoizeN from "../../../helpers/memoizeN"
|
||||
|
||||
const memoizeForGetComponent = (fn) => {
|
||||
const resolver = (...args) => JSON.stringify(args)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import BasePreset from "./base"
|
||||
import OAS3Plugin from "../plugins/oas3"
|
||||
import OAS31Plugin from "../plugins/oas31"
|
||||
import JSONSchema202012Plugin from "../plugins/json-schema-2020-12"
|
||||
|
||||
export default function PresetApis() {
|
||||
return [BasePreset, OAS3Plugin, JSONSchema202012Plugin, OAS31Plugin]
|
||||
}
|
||||
11
src/core/presets/apis/index.js
Normal file
11
src/core/presets/apis/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import BasePreset from "core/presets/base"
|
||||
import OpenAPI30Plugin from "core/plugins/oas3"
|
||||
import OpenAPI31Plugin from "core/plugins/oas31"
|
||||
import JSONSchema202012Plugin from "core/plugins/json-schema-2020-12"
|
||||
|
||||
export default function PresetApis() {
|
||||
return [BasePreset, OpenAPI30Plugin, JSONSchema202012Plugin, OpenAPI31Plugin]
|
||||
}
|
||||
49
src/core/presets/base/index.js
Normal file
49
src/core/presets/base/index.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import AuthPlugin from "core/plugins/auth/"
|
||||
import ConfigsPlugin from "core/plugins/configs"
|
||||
import DeepLinkingPlugin from "core/plugins/deep-linking"
|
||||
import ErrPlugin from "core/plugins/err"
|
||||
import FilterPlugin from "core/plugins/filter"
|
||||
import IconsPlugin from "core/plugins/icons"
|
||||
import LayoutPlugin from "core/plugins/layout"
|
||||
import LogsPlugin from "core/plugins/logs"
|
||||
import OnCompletePlugin from "core/plugins/on-complete"
|
||||
import RequestSnippetsPlugin from "core/plugins/request-snippets"
|
||||
import SamplesPlugin from "core/plugins/samples"
|
||||
import SpecPlugin from "core/plugins/spec"
|
||||
import SwaggerClientPlugin from "core/plugins/swagger-client"
|
||||
import UtilPlugin from "core/plugins/util"
|
||||
import ViewPlugin from "core/plugins/view"
|
||||
import DownloadUrlPlugin from "core/plugins/download-url"
|
||||
import SafeRenderPlugin from "core/plugins/safe-render"
|
||||
// ad-hoc plugins
|
||||
import CoreComponentsPlugin from "core/presets/base/plugins/core-components"
|
||||
import FormComponentsPlugin from "core/presets/base/plugins/form-components"
|
||||
import JSONSchemaComponentsPlugin from "core/presets/base/plugins/json-schema-components"
|
||||
|
||||
const BasePreset = () => [
|
||||
ConfigsPlugin,
|
||||
UtilPlugin,
|
||||
LogsPlugin,
|
||||
ViewPlugin,
|
||||
SpecPlugin,
|
||||
ErrPlugin,
|
||||
IconsPlugin,
|
||||
LayoutPlugin,
|
||||
SamplesPlugin,
|
||||
CoreComponentsPlugin,
|
||||
FormComponentsPlugin,
|
||||
SwaggerClientPlugin,
|
||||
JSONSchemaComponentsPlugin,
|
||||
AuthPlugin,
|
||||
DownloadUrlPlugin,
|
||||
DeepLinkingPlugin,
|
||||
FilterPlugin,
|
||||
OnCompletePlugin,
|
||||
RequestSnippetsPlugin,
|
||||
SafeRenderPlugin(),
|
||||
]
|
||||
|
||||
export default BasePreset
|
||||
@@ -1,26 +1,6 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import err from "core/plugins/err"
|
||||
import layout from "core/plugins/layout"
|
||||
import spec from "core/plugins/spec"
|
||||
import view from "core/plugins/view"
|
||||
import samples from "core/plugins/samples"
|
||||
import requestSnippets from "core/plugins/request-snippets"
|
||||
import logs from "core/plugins/logs"
|
||||
import swaggerJs from "core/plugins/swagger-js"
|
||||
import auth from "core/plugins/auth"
|
||||
import util from "core/plugins/util"
|
||||
import downloadUrlPlugin from "core/plugins/download-url"
|
||||
import configsPlugin from "core/plugins/configs"
|
||||
import deepLinkingPlugin from "core/plugins/deep-linking"
|
||||
import filter from "core/plugins/filter"
|
||||
import onComplete from "core/plugins/on-complete"
|
||||
import safeRender from "core/plugins/safe-render"
|
||||
import iconsPlugin from "core/plugins/icons"
|
||||
|
||||
import OperationContainer from "core/containers/OperationContainer"
|
||||
|
||||
import App from "core/components/app"
|
||||
import AuthorizationPopup from "core/components/auth/authorization-popup"
|
||||
import AuthorizeBtn from "core/components/auth/authorize-btn"
|
||||
@@ -41,6 +21,7 @@ import OnlineValidatorBadge from "core/components/online-validator-badge"
|
||||
import Operations from "core/components/operations"
|
||||
import OperationTag from "core/components/operation-tag"
|
||||
import Operation from "core/components/operation"
|
||||
import OperationContainer from "core/containers/OperationContainer"
|
||||
import OperationSummary from "core/components/operation-summary"
|
||||
import OperationSummaryMethod from "core/components/operation-summary-method"
|
||||
import OperationSummaryPath from "core/components/operation-summary-path"
|
||||
@@ -91,116 +72,83 @@ import DeepLink from "core/components/deep-link"
|
||||
import SvgAssets from "core/components/svg-assets"
|
||||
import Markdown from "core/components/providers/markdown"
|
||||
import BaseLayout from "core/components/layouts/base"
|
||||
import * as LayoutUtils from "core/components/layout-utils"
|
||||
import * as JsonSchemaComponents from "core/json-schema-components"
|
||||
|
||||
export default function () {
|
||||
let coreComponents = {
|
||||
components: {
|
||||
App,
|
||||
authorizationPopup: AuthorizationPopup,
|
||||
authorizeBtn: AuthorizeBtn,
|
||||
AuthorizeBtnContainer,
|
||||
authorizeOperationBtn: AuthorizeOperationBtn,
|
||||
auths: Auths,
|
||||
AuthItem: AuthItem,
|
||||
authError: AuthError,
|
||||
oauth2: Oauth2,
|
||||
apiKeyAuth: ApiKeyAuth,
|
||||
basicAuth: BasicAuth,
|
||||
clear: Clear,
|
||||
liveResponse: LiveResponse,
|
||||
InitializedInput,
|
||||
info: Info,
|
||||
InfoContainer,
|
||||
InfoUrl,
|
||||
InfoBasePath,
|
||||
Contact,
|
||||
License,
|
||||
JumpToPath,
|
||||
CopyToClipboardBtn,
|
||||
onlineValidatorBadge: OnlineValidatorBadge,
|
||||
operations: Operations,
|
||||
operation: Operation,
|
||||
OperationSummary,
|
||||
OperationSummaryMethod,
|
||||
OperationSummaryPath,
|
||||
highlightCode: HighlightCode,
|
||||
responses: Responses,
|
||||
response: Response,
|
||||
ResponseExtension: ResponseExtension,
|
||||
responseBody: ResponseBody,
|
||||
parameters: Parameters,
|
||||
parameterRow: ParameterRow,
|
||||
execute: Execute,
|
||||
headers: Headers,
|
||||
errors: Errors,
|
||||
contentType: ContentType,
|
||||
overview: Overview,
|
||||
footer: Footer,
|
||||
FilterContainer,
|
||||
ParamBody: ParamBody,
|
||||
curl: Curl,
|
||||
schemes: Schemes,
|
||||
SchemesContainer,
|
||||
modelExample: ModelExample,
|
||||
ModelWrapper,
|
||||
ModelCollapse,
|
||||
Model,
|
||||
Models,
|
||||
EnumModel,
|
||||
ObjectModel,
|
||||
ArrayModel,
|
||||
PrimitiveModel,
|
||||
Property,
|
||||
TryItOutButton,
|
||||
Markdown,
|
||||
BaseLayout,
|
||||
VersionPragmaFilter,
|
||||
VersionStamp,
|
||||
OpenAPIVersion,
|
||||
OperationExt,
|
||||
OperationExtRow,
|
||||
ParameterExt,
|
||||
ParameterIncludeEmpty,
|
||||
OperationTag,
|
||||
OperationContainer,
|
||||
DeepLink,
|
||||
SvgAssets,
|
||||
Example,
|
||||
ExamplesSelect,
|
||||
ExamplesSelectValueRetainer,
|
||||
},
|
||||
}
|
||||
const CoreComponentsPlugin = () => ({
|
||||
components: {
|
||||
App,
|
||||
authorizationPopup: AuthorizationPopup,
|
||||
authorizeBtn: AuthorizeBtn,
|
||||
AuthorizeBtnContainer,
|
||||
authorizeOperationBtn: AuthorizeOperationBtn,
|
||||
auths: Auths,
|
||||
AuthItem: AuthItem,
|
||||
authError: AuthError,
|
||||
oauth2: Oauth2,
|
||||
apiKeyAuth: ApiKeyAuth,
|
||||
basicAuth: BasicAuth,
|
||||
clear: Clear,
|
||||
liveResponse: LiveResponse,
|
||||
InitializedInput,
|
||||
info: Info,
|
||||
InfoContainer,
|
||||
InfoUrl,
|
||||
InfoBasePath,
|
||||
Contact,
|
||||
License,
|
||||
JumpToPath,
|
||||
CopyToClipboardBtn,
|
||||
onlineValidatorBadge: OnlineValidatorBadge,
|
||||
operations: Operations,
|
||||
operation: Operation,
|
||||
OperationSummary,
|
||||
OperationSummaryMethod,
|
||||
OperationSummaryPath,
|
||||
highlightCode: HighlightCode,
|
||||
responses: Responses,
|
||||
response: Response,
|
||||
ResponseExtension: ResponseExtension,
|
||||
responseBody: ResponseBody,
|
||||
parameters: Parameters,
|
||||
parameterRow: ParameterRow,
|
||||
execute: Execute,
|
||||
headers: Headers,
|
||||
errors: Errors,
|
||||
contentType: ContentType,
|
||||
overview: Overview,
|
||||
footer: Footer,
|
||||
FilterContainer,
|
||||
ParamBody: ParamBody,
|
||||
curl: Curl,
|
||||
schemes: Schemes,
|
||||
SchemesContainer,
|
||||
modelExample: ModelExample,
|
||||
ModelWrapper,
|
||||
ModelCollapse,
|
||||
Model,
|
||||
Models,
|
||||
EnumModel,
|
||||
ObjectModel,
|
||||
ArrayModel,
|
||||
PrimitiveModel,
|
||||
Property,
|
||||
TryItOutButton,
|
||||
Markdown,
|
||||
BaseLayout,
|
||||
VersionPragmaFilter,
|
||||
VersionStamp,
|
||||
OperationExt,
|
||||
OperationExtRow,
|
||||
ParameterExt,
|
||||
ParameterIncludeEmpty,
|
||||
OperationTag,
|
||||
OperationContainer,
|
||||
OpenAPIVersion,
|
||||
DeepLink,
|
||||
SvgAssets,
|
||||
Example,
|
||||
ExamplesSelect,
|
||||
ExamplesSelectValueRetainer,
|
||||
},
|
||||
})
|
||||
|
||||
let formComponents = {
|
||||
components: LayoutUtils,
|
||||
}
|
||||
|
||||
let jsonSchemaComponents = {
|
||||
components: JsonSchemaComponents,
|
||||
}
|
||||
|
||||
return [
|
||||
configsPlugin,
|
||||
util,
|
||||
logs,
|
||||
view,
|
||||
spec,
|
||||
err,
|
||||
layout,
|
||||
samples,
|
||||
coreComponents,
|
||||
formComponents,
|
||||
swaggerJs,
|
||||
jsonSchemaComponents,
|
||||
auth,
|
||||
downloadUrlPlugin,
|
||||
deepLinkingPlugin,
|
||||
filter,
|
||||
onComplete,
|
||||
requestSnippets,
|
||||
iconsPlugin,
|
||||
safeRender(),
|
||||
]
|
||||
}
|
||||
export default CoreComponentsPlugin
|
||||
10
src/core/presets/base/plugins/form-components/index.js
Normal file
10
src/core/presets/base/plugins/form-components/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import * as LayoutUtils from "core/components/layout-utils"
|
||||
|
||||
const FormComponentsPlugin = () => ({
|
||||
components: { ...LayoutUtils },
|
||||
})
|
||||
|
||||
export default FormComponentsPlugin
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import * as JSONSchemaComponents from "core/components/json-schema-components"
|
||||
|
||||
const JSONSchemaComponentsPlugin = () => ({
|
||||
components: { ...JSONSchemaComponents },
|
||||
})
|
||||
|
||||
export default JSONSchemaComponentsPlugin
|
||||
@@ -1,16 +0,0 @@
|
||||
import PropTypes from "prop-types"
|
||||
|
||||
// Takes a list and proptype, and returns a PropType.shape({ [item]: propType })
|
||||
const mapListToPropTypeShape = (list, propType) => PropTypes.shape(
|
||||
list.reduce((shape, propName) => {
|
||||
shape[propName] = propType
|
||||
return shape
|
||||
}, {}))
|
||||
|
||||
|
||||
export const arrayOrString = PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.string),
|
||||
PropTypes.string,
|
||||
])
|
||||
|
||||
export const objectWithFuncs = list => mapListToPropTypeShape(list, PropTypes.func.isRequired)
|
||||
@@ -5,7 +5,7 @@ import deepExtend from "deep-extend"
|
||||
import { combineReducers } from "redux-immutable"
|
||||
import { serializeError } from "serialize-error"
|
||||
import merge from "lodash/merge"
|
||||
import { NEW_THROWN_ERR } from "corePlugins/err/actions"
|
||||
import { NEW_THROWN_ERR } from "core/plugins/err/actions"
|
||||
import win from "core/window"
|
||||
|
||||
import { systemThunkMiddleware, isFn, objMap, objReduce, isObject, isArray, isFunc } from "core/utils"
|
||||
|
||||
@@ -18,11 +18,12 @@ import find from "lodash/find"
|
||||
import some from "lodash/some"
|
||||
import eq from "lodash/eq"
|
||||
import isFunction from "lodash/isFunction"
|
||||
import win from "./window"
|
||||
import cssEscape from "css.escape"
|
||||
import getParameterSchema from "../helpers/get-parameter-schema"
|
||||
import randomBytes from "randombytes"
|
||||
import shaJs from "sha.js"
|
||||
import win from "core/window"
|
||||
import getParameterSchema from "core/utils/get-parameter-schema"
|
||||
|
||||
|
||||
const DEFAULT_RESPONSE_KEY = "default"
|
||||
|
||||
@@ -117,11 +118,11 @@ export function createObjWithHashedKeys (fdObj) {
|
||||
}
|
||||
|
||||
export function bindToState(obj, state) {
|
||||
var newObj = {}
|
||||
Object.keys(obj)
|
||||
.filter(key => typeof obj[key] === "function")
|
||||
.forEach(key => newObj[key] = obj[key].bind(null, state))
|
||||
return newObj
|
||||
var newObj = {}
|
||||
Object.keys(obj)
|
||||
.filter(key => typeof obj[key] === "function")
|
||||
.forEach(key => newObj[key] = obj[key].bind(null, state))
|
||||
return newObj
|
||||
}
|
||||
|
||||
export function normalizeArray(arr) {
|
||||
@@ -344,21 +345,21 @@ export const validateString = ( val ) => {
|
||||
}
|
||||
|
||||
export const validateDateTime = (val) => {
|
||||
if (isNaN(Date.parse(val))) {
|
||||
return "Value must be a DateTime"
|
||||
}
|
||||
if (isNaN(Date.parse(val))) {
|
||||
return "Value must be a DateTime"
|
||||
}
|
||||
}
|
||||
|
||||
export const validateGuid = (val) => {
|
||||
val = val.toString().toLowerCase()
|
||||
if (!/^[{(]?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}[)}]?$/.test(val)) {
|
||||
return "Value must be a Guid"
|
||||
}
|
||||
val = val.toString().toLowerCase()
|
||||
if (!/^[{(]?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}[)}]?$/.test(val)) {
|
||||
return "Value must be a Guid"
|
||||
}
|
||||
}
|
||||
|
||||
export const validateMaxLength = (val, max) => {
|
||||
if (val.length > max) {
|
||||
return `Value must be no longer than ${max} character${max !== 1 ? "s" : ""}`
|
||||
return `Value must be no longer than ${max} character${max !== 1 ? "s" : ""}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +387,7 @@ export const validateUniqueItems = (val, uniqueItems) => {
|
||||
|
||||
export const validateMinItems = (val, min) => {
|
||||
if (!val && min >= 1 || val && val.length < min) {
|
||||
return `Array must contain at least ${min} item${min === 1 ? "" : "s"}`
|
||||
return `Array must contain at least ${min} item${min === 1 ? "" : "s"}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,14 +399,14 @@ export const validateMaxItems = (val, max) => {
|
||||
|
||||
export const validateMinLength = (val, min) => {
|
||||
if (val.length < min) {
|
||||
return `Value must be at least ${min} character${min !== 1 ? "s" : ""}`
|
||||
return `Value must be at least ${min} character${min !== 1 ? "s" : ""}`
|
||||
}
|
||||
}
|
||||
|
||||
export const validatePattern = (val, rxPattern) => {
|
||||
var patt = new RegExp(rxPattern)
|
||||
if (!patt.test(val)) {
|
||||
return "Value must follow pattern " + rxPattern
|
||||
return "Value must follow pattern " + rxPattern
|
||||
}
|
||||
}
|
||||
|
||||
@@ -823,10 +824,10 @@ export function generateCodeVerifier() {
|
||||
|
||||
export function createCodeChallenge(codeVerifier) {
|
||||
return b64toB64UrlEncoded(
|
||||
shaJs("sha256")
|
||||
shaJs("sha256")
|
||||
.update(codeVerifier)
|
||||
.digest("base64")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
function b64toB64UrlEncoded(str) {
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 581 B |
@@ -1,7 +0,0 @@
|
||||
import Configs from "./configs"
|
||||
import Topbar from "./topbar"
|
||||
|
||||
export default {
|
||||
Configs,
|
||||
Topbar
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import Topbar from "./topbar"
|
||||
import Logo from "./logo"
|
||||
|
||||
export default function () {
|
||||
return {
|
||||
components: {
|
||||
Topbar,
|
||||
Logo
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from "react"
|
||||
import SwaggerUILogo from "./logo_small.svg"
|
||||
|
||||
export const Logo = () => (
|
||||
<img height="40" src={ SwaggerUILogo } alt="Swagger UI"/>
|
||||
)
|
||||
|
||||
export default Logo
|
||||
@@ -1,24 +0,0 @@
|
||||
import StandaloneLayout from "./layout"
|
||||
import TopbarPlugin from "plugins/topbar"
|
||||
import ConfigsPlugin from "corePlugins/configs"
|
||||
import SafeRenderPlugin from "core/plugins/safe-render"
|
||||
|
||||
// the Standalone preset
|
||||
|
||||
export default [
|
||||
TopbarPlugin,
|
||||
ConfigsPlugin,
|
||||
() => {
|
||||
return {
|
||||
components: { StandaloneLayout }
|
||||
}
|
||||
},
|
||||
SafeRenderPlugin({
|
||||
fullOverride: true,
|
||||
componentList: [
|
||||
"Topbar",
|
||||
"StandaloneLayout",
|
||||
"onlineValidatorBadge"
|
||||
]
|
||||
})
|
||||
]
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
|
||||
export default class StandaloneLayout extends React.Component {
|
||||
class StandaloneLayout extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
errSelectors: PropTypes.object.isRequired,
|
||||
@@ -36,3 +36,5 @@ export default class StandaloneLayout extends React.Component {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default StandaloneLayout
|
||||
12
src/standalone/plugins/stadalone-layout/index.js
Normal file
12
src/standalone/plugins/stadalone-layout/index.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import StandaloneLayout from "./components/StandaloneLayout"
|
||||
|
||||
const StandaloneLayoutPlugin = () => ({
|
||||
components: {
|
||||
StandaloneLayout,
|
||||
},
|
||||
})
|
||||
|
||||
export default StandaloneLayoutPlugin
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
9
src/standalone/plugins/top-bar/components/Logo.jsx
Normal file
9
src/standalone/plugins/top-bar/components/Logo.jsx
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import React from "react"
|
||||
import SwaggerUILogo from "../assets/logo_small.svg"
|
||||
|
||||
const Logo = () => <img height="40" src={SwaggerUILogo} alt="Swagger UI" />
|
||||
|
||||
export default Logo
|
||||
@@ -1,10 +1,9 @@
|
||||
import React, { cloneElement } from "react"
|
||||
import PropTypes from "prop-types"
|
||||
|
||||
//import "./topbar.less"
|
||||
import {parseSearch, serializeSearch} from "../../core/utils"
|
||||
import {parseSearch, serializeSearch} from "core/utils"
|
||||
|
||||
export default class Topbar extends React.Component {
|
||||
class TopBar extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
layoutActions: PropTypes.object.isRequired,
|
||||
@@ -163,9 +162,11 @@ export default class Topbar extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
Topbar.propTypes = {
|
||||
TopBar.propTypes = {
|
||||
specSelectors: PropTypes.object.isRequired,
|
||||
specActions: PropTypes.object.isRequired,
|
||||
getComponent: PropTypes.func.isRequired,
|
||||
getConfigs: PropTypes.func.isRequired
|
||||
}
|
||||
|
||||
export default TopBar
|
||||
11
src/standalone/plugins/top-bar/index.js
Normal file
11
src/standalone/plugins/top-bar/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import TopBar from "./components/TopBar"
|
||||
import Logo from "./components/Logo"
|
||||
|
||||
const TopBarPlugin = () => ({
|
||||
components: { Topbar: TopBar, Logo },
|
||||
})
|
||||
|
||||
export default TopBarPlugin
|
||||
19
src/standalone/presets/standalone/index.js
Normal file
19
src/standalone/presets/standalone/index.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import StandaloneLayoutPlugin from "standalone/plugins/stadalone-layout"
|
||||
import TopBarPlugin from "standalone/plugins/top-bar"
|
||||
import ConfigsPlugin from "core/plugins/configs"
|
||||
import SafeRenderPlugin from "core/plugins/safe-render"
|
||||
|
||||
const StandalonePreset = [
|
||||
TopBarPlugin,
|
||||
ConfigsPlugin,
|
||||
StandaloneLayoutPlugin,
|
||||
SafeRenderPlugin({
|
||||
fullOverride: true,
|
||||
componentList: ["Topbar", "StandaloneLayout", "onlineValidatorBadge"],
|
||||
}),
|
||||
]
|
||||
|
||||
export default StandalonePreset
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react"
|
||||
import expect from "expect"
|
||||
import { shallow } from "enzyme"
|
||||
import HighlightCode from "components/highlight-code"
|
||||
import HighlightCode from "core/components/highlight-code"
|
||||
|
||||
const fakeGetConfigs = () => ({syntaxHighlight: {activated: true, theme: "agate"}})
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react"
|
||||
import expect from "expect"
|
||||
import { shallow } from "enzyme"
|
||||
import ResponseBody from "components/response-body"
|
||||
import ResponseBody from "core/components/response-body"
|
||||
|
||||
describe("<ResponseBody />", function() {
|
||||
const highlightCodeComponent = () => null
|
||||
|
||||
@@ -4,8 +4,8 @@ import { fromJSOrdered } from "core/utils"
|
||||
import sinon from "sinon"
|
||||
import expect from "expect"
|
||||
import { shallow } from "enzyme"
|
||||
import LiveResponse from "components/live-response"
|
||||
import ResponseBody from "components/response-body"
|
||||
import LiveResponse from "core/components/live-response"
|
||||
import ResponseBody from "core/components/response-body"
|
||||
import RequestSnippets from "core/plugins/request-snippets/request-snippets"
|
||||
|
||||
describe("<LiveResponse/>", function () {
|
||||
|
||||
@@ -3,7 +3,7 @@ import React from "react"
|
||||
import expect from "expect"
|
||||
import { mount } from "enzyme"
|
||||
import { fromJS, Map } from "immutable"
|
||||
import OnlineValidatorBadge from "components/online-validator-badge"
|
||||
import OnlineValidatorBadge from "core/components/online-validator-badge"
|
||||
|
||||
describe("<OnlineValidatorBadge/>", function () {
|
||||
it("should render a validator link and image correctly for the default validator", function () {
|
||||
|
||||
@@ -3,7 +3,7 @@ import React from "react"
|
||||
import expect from "expect"
|
||||
import { mount } from "enzyme"
|
||||
import { fromJS, Map } from "immutable"
|
||||
import OnlineValidatorBadge from "components/online-validator-badge"
|
||||
import OnlineValidatorBadge from "core/components/online-validator-badge"
|
||||
|
||||
describe("<OnlineValidatorBadge/> Anchor Target Safety", function () {
|
||||
it("should render a validator link with safe `rel` attributes", function () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react"
|
||||
import { render } from "enzyme"
|
||||
import Markdown from "components/providers/markdown"
|
||||
import Markdown from "core/components/providers/markdown"
|
||||
|
||||
describe("UI-3199: Sanitized Markdown causing code examples to be double escaped", function(){
|
||||
it("should single-escape quotes", function(){
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react"
|
||||
import { render } from "enzyme"
|
||||
import Markdown from "components/providers/markdown"
|
||||
import Markdown from "core/components/providers/markdown"
|
||||
|
||||
describe("UI-3279: Empty Markdown inputs causing bare `undefined` in output", function(){
|
||||
it("should return no text for `null` as source input", function(){
|
||||
|
||||
@@ -5,7 +5,7 @@ import React from "react"
|
||||
import { List, fromJS } from "immutable"
|
||||
import { render } from "enzyme"
|
||||
|
||||
import ParameterRow from "components/parameter-row"
|
||||
import ParameterRow from "core/components/parameter-row"
|
||||
import {
|
||||
memoizedSampleFromSchema,
|
||||
memoizedCreateXMLExample,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react"
|
||||
import { mount } from "enzyme"
|
||||
import FilterContainer from "containers/filter"
|
||||
import { Col } from "components/layout-utils"
|
||||
import FilterContainer from "core/containers/filter"
|
||||
import { Col } from "core/components/layout-utils"
|
||||
|
||||
describe("<FilterContainer/>", function(){
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react"
|
||||
import { mount } from "enzyme"
|
||||
import { fromJS } from "immutable"
|
||||
import InfoContainer from "containers/info"
|
||||
import InfoContainer from "core/containers/info"
|
||||
|
||||
describe("<InfoContainer/>", function () {
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import React from "react"
|
||||
import Immutable, { List } from "immutable"
|
||||
import { Select, Input, TextArea } from "components/layout-utils"
|
||||
import { Select, Input, TextArea } from "core/components/layout-utils"
|
||||
import { mount, render } from "enzyme"
|
||||
import * as JsonSchemaComponents from "core/json-schema-components"
|
||||
import { JsonSchemaForm } from "core/json-schema-components"
|
||||
import * as JsonSchemaComponents from "core/components/json-schema-components"
|
||||
|
||||
const components = {...JsonSchemaComponents, Select, Input, TextArea}
|
||||
|
||||
@@ -13,7 +12,7 @@ const getComponentStub = (name) => {
|
||||
return null
|
||||
}
|
||||
|
||||
describe("<JsonSchemaForm/>", function(){
|
||||
describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
describe("strings", function() {
|
||||
it("should render the correct options for a string enum parameter", function(){
|
||||
|
||||
@@ -29,7 +28,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
})
|
||||
}
|
||||
|
||||
let wrapper = render(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = render(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
expect(wrapper.get(0).name).toEqual("select")
|
||||
expect(wrapper.find("option").length).toEqual(3)
|
||||
@@ -53,7 +52,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
disabled: true
|
||||
}
|
||||
|
||||
let wrapper = render(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = render(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
expect(wrapper.attr("disabled")).toEqual("disabled")
|
||||
})
|
||||
@@ -74,7 +73,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
})
|
||||
}
|
||||
|
||||
let wrapper = render(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = render(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
expect(wrapper.get(0).name).toEqual("select")
|
||||
expect(wrapper.find("select option").length).toEqual(2)
|
||||
@@ -96,7 +95,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
})
|
||||
}
|
||||
|
||||
let wrapper = render(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = render(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
expect(wrapper.get(0).name).toEqual("select")
|
||||
expect(wrapper.find("select option").length).toEqual(3)
|
||||
@@ -120,7 +119,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
})
|
||||
}
|
||||
|
||||
let wrapper = render(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = render(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
expect(wrapper.get(0).name).toEqual("select")
|
||||
expect(wrapper.find("select option").length).toEqual(2)
|
||||
@@ -143,7 +142,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
})
|
||||
}
|
||||
|
||||
let wrapper = render(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = render(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
expect(wrapper.get(0).name).toEqual("select")
|
||||
expect(wrapper.find("select option").length).toEqual(3)
|
||||
@@ -168,7 +167,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
})
|
||||
}
|
||||
|
||||
let wrapper = render(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = render(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
expect(wrapper.get(0).name).toEqual("select")
|
||||
expect(wrapper.find("select option").length).toEqual(1)
|
||||
@@ -200,7 +199,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
})
|
||||
}
|
||||
|
||||
let wrapper = mount(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = mount(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
updateQueue.forEach(newProps => wrapper.setProps(newProps))
|
||||
|
||||
@@ -223,7 +222,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
}
|
||||
|
||||
|
||||
let wrapper = render(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = render(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
expect(wrapper.length).toEqual(1)
|
||||
expect(wrapper.get(0).name).toEqual("input")
|
||||
@@ -246,7 +245,7 @@ describe("<JsonSchemaForm/>", function(){
|
||||
}
|
||||
|
||||
|
||||
let wrapper = render(<JsonSchemaForm {...props}/>)
|
||||
let wrapper = render(<JsonSchemaComponents.JsonSchemaForm {...props}/>)
|
||||
|
||||
expect(wrapper.length).toEqual(1)
|
||||
expect(wrapper.get(0).name).toEqual("input")
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react"
|
||||
import { fromJSOrdered } from "core/utils"
|
||||
import { shallow } from "enzyme"
|
||||
import Curl from "components/curl"
|
||||
import LiveResponse from "components/live-response"
|
||||
import ResponseBody from "components/response-body"
|
||||
import Curl from "core/components/curl"
|
||||
import LiveResponse from "core/components/live-response"
|
||||
import ResponseBody from "core/components/response-body"
|
||||
|
||||
describe("<LiveResponse/>", function(){
|
||||
let request = fromJSOrdered({
|
||||
@@ -49,7 +49,7 @@ describe("<LiveResponse/>", function(){
|
||||
})
|
||||
|
||||
let mutatedRequestForSpy = jest.fn().mockImplementation(function(mutatedRequest) { return mutatedRequest })
|
||||
let requestForSpy = jest.fn().mockImplementation(function(request) { return request })
|
||||
let requestForSpy = jest.fn().mockImplementation(function(request) { return request })
|
||||
|
||||
let components = {
|
||||
curl: Curl,
|
||||
@@ -57,7 +57,7 @@ describe("<LiveResponse/>", function(){
|
||||
}
|
||||
|
||||
let props = {
|
||||
response: response,
|
||||
response: response,
|
||||
specSelectors: {
|
||||
mutatedRequestFor: mutatedRequestForSpy,
|
||||
requestFor: requestForSpy,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react"
|
||||
import { render } from "enzyme"
|
||||
import Markdown from "components/providers/markdown"
|
||||
import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markdown.jsx"
|
||||
import Markdown from "core/components/providers/markdown"
|
||||
import { Markdown as OAS3Markdown } from "core/plugins/oas3/wrap-components/markdown.jsx"
|
||||
|
||||
describe("Markdown component", function () {
|
||||
describe("Swagger 2.0", function () {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import ModelExample from "components/model-example"
|
||||
import ModelComponent from "components/model-wrapper"
|
||||
import ModelExample from "core/components/model-example"
|
||||
import ModelComponent from "core/components/model-wrapper"
|
||||
|
||||
describe("<ModelExample/>", function(){
|
||||
let components, props
|
||||
|
||||
|
||||
let exampleSelectedTestInputs = [
|
||||
{ defaultModelRendering: "model", isExecute: true },
|
||||
{ defaultModelRendering: "example", isExecute: true },
|
||||
@@ -13,7 +13,7 @@ describe("<ModelExample/>", function(){
|
||||
{ defaultModelRendering: "othervalue", isExecute: true },
|
||||
{ defaultModelRendering: "othervalue", isExecute: false }
|
||||
]
|
||||
|
||||
|
||||
let modelSelectedTestInputs = [
|
||||
{ defaultModelRendering: "model", isExecute: false }
|
||||
]
|
||||
@@ -22,7 +22,7 @@ describe("<ModelExample/>", function(){
|
||||
components = {
|
||||
ModelWrapper: ModelComponent
|
||||
}
|
||||
|
||||
|
||||
props = {
|
||||
getComponent: (c) => {
|
||||
return components[c]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import { fromJS, Map } from "immutable"
|
||||
import Models from "components/models"
|
||||
import ModelCollapse from "components/model-collapse"
|
||||
import ModelComponent from "components/model-wrapper"
|
||||
import Models from "core/components/models"
|
||||
import ModelCollapse from "core/components/model-collapse"
|
||||
import ModelComponent from "core/components/model-wrapper"
|
||||
|
||||
describe("<Models/>", function(){
|
||||
const dummyComponent = () => null
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import { List } from "immutable"
|
||||
import ObjectModel from "components/object-model"
|
||||
// import ModelExample from "components/model-example"
|
||||
import ObjectModel from "core/components/object-model"
|
||||
// import ModelExample from "core/components/model-example"
|
||||
import Immutable from "immutable"
|
||||
import Model from "components/model"
|
||||
import ModelCollapse from "components/model-collapse"
|
||||
import Property from "components/property"
|
||||
// import { inferSchema } from "corePlugins/samples/fn"
|
||||
import Model from "core/components/model"
|
||||
import ModelCollapse from "core/components/model-collapse"
|
||||
import Property from "core/components/property"
|
||||
// import { inferSchema } from "core/plugins/samples/fn"
|
||||
|
||||
describe("<ObjectModel />", function() {
|
||||
const dummyComponent = () => null
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react"
|
||||
import { mount } from "enzyme"
|
||||
import OnlineValidatorBadge from "components/online-validator-badge"
|
||||
import OnlineValidatorBadge from "core/components/online-validator-badge"
|
||||
|
||||
describe("<OnlineValidatorBadge/>", function () {
|
||||
it("should render a validator link and image correctly for the default validator", function () {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import OperationTag from "components/operation-tag"
|
||||
import OperationTag from "core/components/operation-tag"
|
||||
import Im from "immutable"
|
||||
import { Link } from "components/layout-utils"
|
||||
import { Link } from "core/components/layout-utils"
|
||||
|
||||
describe("<OperationTag/>", function(){
|
||||
it("render externalDocs URL for swagger v2", function(){
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import Operation from "components/operation"
|
||||
import Operation from "core/components/operation"
|
||||
|
||||
describe("<Operation/>", function(){
|
||||
it.skip("blanket tests", function(){
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react"
|
||||
import { render } from "enzyme"
|
||||
import { fromJS } from "immutable"
|
||||
import DeepLink from "components/deep-link"
|
||||
import Operations from "components/operations"
|
||||
import {Collapse} from "components/layout-utils"
|
||||
import DeepLink from "core/components/deep-link"
|
||||
import Operations from "core/components/operations"
|
||||
import {Collapse} from "core/components/layout-utils"
|
||||
|
||||
const components = {
|
||||
Collapse,
|
||||
|
||||
@@ -5,7 +5,7 @@ import React from "react"
|
||||
import { List, fromJS } from "immutable"
|
||||
import { render } from "enzyme"
|
||||
|
||||
import ParameterRow from "components/parameter-row"
|
||||
import ParameterRow from "core/components/parameter-row"
|
||||
import {
|
||||
memoizedSampleFromSchema,
|
||||
memoizedCreateXMLExample,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import { fromJS } from "immutable"
|
||||
import PrimitiveModel from "components/primitive-model"
|
||||
import ModelCollapse from "components/model-collapse"
|
||||
import PrimitiveModel from "core/components/primitive-model"
|
||||
import ModelCollapse from "core/components/model-collapse"
|
||||
|
||||
describe("<PrimitiveModel/>", function () {
|
||||
const dummyComponent = () => null
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import ResponseBody from "components/response-body"
|
||||
import ResponseBody from "core/components/response-body"
|
||||
|
||||
describe("<ResponseBody />", function () {
|
||||
const highlightCodeComponent = () => null
|
||||
|
||||
@@ -5,8 +5,8 @@ import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import { fromJS, List } from "immutable"
|
||||
|
||||
import Response from "components/response"
|
||||
import ModelExample from "components/model-example"
|
||||
import Response from "core/components/response"
|
||||
import ModelExample from "core/components/model-example"
|
||||
import {
|
||||
inferSchema,
|
||||
memoizedSampleFromSchema,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react"
|
||||
import { mount } from "enzyme"
|
||||
import { fromJS } from "immutable"
|
||||
import SchemesContainer from "containers/schemes"
|
||||
import Schemes from "components/schemes"
|
||||
import { Col } from "components/layout-utils"
|
||||
import SchemesContainer from "core/containers/schemes"
|
||||
import Schemes from "core/components/schemes"
|
||||
import { Col } from "core/components/layout-utils"
|
||||
|
||||
describe("<SchemesContainer/>", function(){
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import { fromJS } from "immutable"
|
||||
import Schemes from "components/schemes"
|
||||
import Schemes from "core/components/schemes"
|
||||
|
||||
describe("<Schemes/>", function(){
|
||||
it("calls props.specActions.setScheme() when no currentScheme is selected", function(){
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import VersionPragmaFilter from "components/version-pragma-filter"
|
||||
import VersionPragmaFilter from "core/components/version-pragma-filter"
|
||||
|
||||
describe("<VersionPragmaFilter/>", function(){
|
||||
it("renders children for a Swagger 2 definition", function(){
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
import { fromJS } from "immutable"
|
||||
import getParameterSchema from "../../../../src/helpers/get-parameter-schema"
|
||||
import getParameterSchema from "../../../../src/core/utils/get-parameter-schema"
|
||||
|
||||
describe("getParameterSchema", () => {
|
||||
it("should return an empty Map when given no parameters", () => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
authorizeOauth2WithPersistOption,
|
||||
logoutWithPersistOption,
|
||||
persistAuthorizationIfNeeded
|
||||
} from "corePlugins/auth/actions"
|
||||
} from "core/plugins/auth/actions"
|
||||
import {authorizeAccessCodeWithBasicAuthentication, authPopup} from "../../../../../src/core/plugins/auth/actions"
|
||||
|
||||
describe("auth plugin - actions", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loaded } from "corePlugins/auth/configs-extensions/wrap-actions"
|
||||
import { loaded } from "core/plugins/auth/configs-extensions/wrap-actions"
|
||||
|
||||
describe("loaded hook", () => {
|
||||
describe("authorization data restoration", () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import { fromJS } from "immutable"
|
||||
import { preauthorizeBasic, preauthorizeApiKey } from "corePlugins/auth"
|
||||
import { authorize } from "corePlugins/auth/actions"
|
||||
import { preauthorizeBasic, preauthorizeApiKey } from "core/plugins/auth"
|
||||
import { authorize } from "core/plugins/auth/actions"
|
||||
|
||||
const S2_SYSTEM = {
|
||||
authActions: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
import { fromJS } from "immutable"
|
||||
import { definitionsToAuthorize, definitionsForRequirements } from "corePlugins/auth/selectors"
|
||||
import { definitionsToAuthorize, definitionsForRequirements } from "core/plugins/auth/selectors"
|
||||
|
||||
describe("auth plugin - selectors", () => {
|
||||
describe("definitionsToAuthorize", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { execute } from "corePlugins/auth/spec-extensions/wrap-actions"
|
||||
import { execute } from "core/plugins/auth/spec-extensions/wrap-actions"
|
||||
|
||||
describe("spec plugin - actions", function(){
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @prettier
|
||||
*/
|
||||
import { fromJS } from "immutable"
|
||||
import { authorize, logout } from "corePlugins/auth/wrap-actions"
|
||||
import { authorize, logout } from "core/plugins/auth/wrap-actions"
|
||||
|
||||
describe("Cookie based apiKey persistence in document.cookie", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { downloadConfig } from "corePlugins/configs/spec-actions"
|
||||
import { downloadConfig } from "core/plugins/configs/spec-actions"
|
||||
|
||||
describe("configs plugin - actions", () => {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Map, List } from "immutable"
|
||||
import { transform } from "corePlugins/err/error-transformers/transformers/not-of-type"
|
||||
import { transform } from "core/plugins/err/error-transformers/transformers/not-of-type"
|
||||
|
||||
describe("err plugin - tranformers - not of type", () => {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-useless-escape */
|
||||
import { fromJS } from "immutable"
|
||||
import { transform } from "corePlugins/err/error-transformers/transformers/parameter-oneof"
|
||||
import { transform } from "core/plugins/err/error-transformers/transformers/parameter-oneof"
|
||||
|
||||
describe.skip("err plugin - tranformers - parameter oneof", () => {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Map } from "immutable"
|
||||
import opsFilter from "corePlugins/filter/opsFilter"
|
||||
import opsFilter from "core/plugins/filter/opsFilter"
|
||||
|
||||
describe("opsFilter", function() {
|
||||
const taggedOps = Map([["pet"], ["store"], ["user"]])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { fromJS } from "immutable"
|
||||
import { isOAS30, isSwagger2 } from "corePlugins/oas3/helpers"
|
||||
import { isOAS30, isSwagger2 } from "core/plugins/oas3/helpers"
|
||||
|
||||
const isOAS3Shorthand = (version) => isOAS30(fromJS({
|
||||
openapi: version
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
import { fromJS } from "immutable"
|
||||
import reducer from "corePlugins/oas3/reducers"
|
||||
import reducer from "core/plugins/oas3/reducers"
|
||||
|
||||
describe("oas3 plugin - reducer", function () {
|
||||
describe("SET_REQUEST_BODY_VALIDATE_ERROR", () => {
|
||||
@@ -518,13 +518,13 @@ describe("oas3 plugin - reducer", function () {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const result = clearRequestBodyValue(state, {
|
||||
payload: {
|
||||
pathMethod: ["/pet", "post"],
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const expectedResult = {
|
||||
requestData: {
|
||||
"/pet": {
|
||||
@@ -535,7 +535,7 @@ describe("oas3 plugin - reducer", function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
expect(result.toJS()).toEqual(expectedResult)
|
||||
})
|
||||
})
|
||||
@@ -556,13 +556,13 @@ describe("oas3 plugin - reducer", function () {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const result = clearRequestBodyValue(state, {
|
||||
payload: {
|
||||
pathMethod: ["/pet", "post"],
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const expectedResult = {
|
||||
requestData: {
|
||||
"/pet": {
|
||||
@@ -573,7 +573,7 @@ describe("oas3 plugin - reducer", function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
expect(result.toJS()).toEqual(expectedResult)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@ import { mount } from "enzyme"
|
||||
import { fromJS } from "immutable"
|
||||
import ServersContainer from "core/plugins/oas3/components/servers-container"
|
||||
import Servers from "core/plugins/oas3/components/servers"
|
||||
import { Col } from "components/layout-utils"
|
||||
import { Col } from "core/components/layout-utils"
|
||||
|
||||
describe("<ServersContainer/>", function(){
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@ import {
|
||||
serverVariableValue,
|
||||
serverVariables,
|
||||
serverEffectiveValue
|
||||
} from "corePlugins/oas3/selectors"
|
||||
} from "core/plugins/oas3/selectors"
|
||||
|
||||
import reducers from "corePlugins/oas3/reducers"
|
||||
import reducers from "core/plugins/oas3/reducers"
|
||||
|
||||
import {
|
||||
setSelectedServer,
|
||||
setServerVariableValue,
|
||||
} from "corePlugins/oas3/actions"
|
||||
} from "core/plugins/oas3/actions"
|
||||
|
||||
describe("OAS3 plugin - state", function() {
|
||||
describe("action + reducer + selector integration", function() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { fromJS, Map } from "immutable"
|
||||
import {
|
||||
definitionsToAuthorize
|
||||
} from "corePlugins/oas3/auth-extensions/wrap-selectors"
|
||||
} from "core/plugins/oas3/auth-extensions/wrap-selectors"
|
||||
|
||||
describe("oas3 plugin - auth extensions - wrapSelectors", function(){
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { fromJS } from "immutable"
|
||||
import { definitions } from "corePlugins/oas3/spec-extensions/wrap-selectors"
|
||||
import { definitions } from "core/plugins/oas3/spec-extensions/wrap-selectors"
|
||||
|
||||
describe("oas3 plugin - spec extensions - wrapSelectors", function(){
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { fromJS } from "immutable"
|
||||
import { createXMLExample, sampleFromSchema, memoizedCreateXMLExample, memoizedSampleFromSchema } from "corePlugins/samples/fn/index"
|
||||
import { createXMLExample, sampleFromSchema, memoizedCreateXMLExample, memoizedSampleFromSchema } from "core/plugins/samples/fn/index"
|
||||
|
||||
describe("sampleFromSchema", () => {
|
||||
it("handles Immutable.js objects for nested schemas", function () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
import { fromJS } from "immutable"
|
||||
import { execute, executeRequest, changeParamByIdentity, updateEmptyParamInclusion } from "corePlugins/spec/actions"
|
||||
import { execute, executeRequest, changeParamByIdentity, updateEmptyParamInclusion } from "core/plugins/spec/actions"
|
||||
|
||||
describe("spec plugin - actions", function(){
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
import { fromJS } from "immutable"
|
||||
import reducer from "corePlugins/spec/reducers"
|
||||
import reducer from "core/plugins/spec/reducers"
|
||||
|
||||
describe("spec plugin - reducer", function(){
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user