Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3563b614a | ||
|
|
33e5775dcf | ||
|
|
db2caf62cb | ||
|
|
5a62509728 | ||
|
|
eb548f6396 | ||
|
|
00d23fb052 | ||
|
|
c5222153d0 | ||
|
|
62be80741e | ||
|
|
b41c92f15a | ||
|
|
3951c87ec0 | ||
|
|
5f0cc74e89 | ||
|
|
ce6ce9a5c2 | ||
|
|
81be6d08a6 | ||
|
|
2b37eeff9c | ||
|
|
bece956ad5 | ||
|
|
eefe1267af | ||
|
|
a45cef0e24 | ||
|
|
9409320009 | ||
|
|
a82c466782 | ||
|
|
4749b90350 | ||
|
|
0b56640273 | ||
|
|
26d5305404 | ||
|
|
5c77857b2d | ||
|
|
54ee7f9b67 | ||
|
|
3a2185c158 | ||
|
|
2479b8cdde | ||
|
|
3fe3f0bfdb | ||
|
|
323e0ef77d | ||
|
|
e16954290b | ||
|
|
9afe6802db | ||
|
|
adf4fa854c |
@@ -0,0 +1,10 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
FROM alpine:3.4
|
||||||
|
|
||||||
|
MAINTAINER fehguy
|
||||||
|
|
||||||
|
RUN apk add --update nginx
|
||||||
|
RUN mkdir -p /run/nginx
|
||||||
|
|
||||||
|
COPY nginx.conf /etc/nginx/
|
||||||
|
|
||||||
|
# copy swagger files to the `/js` folder
|
||||||
|
ADD ./dist/ /usr/share/nginx/html/js
|
||||||
|
ADD ./public/* /usr/share/nginx/html
|
||||||
|
|
||||||
|
# change the folder structure
|
||||||
|
RUN sed -i 's/\.\.\/dist/js/g' /usr/share/nginx/html/index.html
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD exec nginx -g 'daemon off;'
|
||||||
@@ -13,7 +13,7 @@ The OpenAPI Specification has undergone 4 revisions since initial creation in 20
|
|||||||
|
|
||||||
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
|
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
|
||||||
------------------ | ------------ | -------------------------- | ----- | ------
|
------------------ | ------------ | -------------------------- | ----- | ------
|
||||||
3.0.0 | 2017-03-17 | 2.0 | [tag v3.0.0](https://github.com/swagger-api/swagger-ui/tree/v3.0.0) |
|
3.0.2 | 2017-03-19 | 2.0 | [tag v3.0.2](https://github.com/swagger-api/swagger-ui/tree/v3.0.2) |
|
||||||
2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) |
|
2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) |
|
||||||
2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) |
|
2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) |
|
||||||
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
|
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
|
||||||
@@ -23,6 +23,16 @@ Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
|
|||||||
|
|
||||||
### How to run
|
### How to run
|
||||||
|
|
||||||
|
##### Easy start! Docker
|
||||||
|
You can pull a pre-built docker image of the swagger-ui directly from Dockerhub:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker pull swaggerapi/swagger-ui
|
||||||
|
docker run -p 80:8080 swaggerapi/swagger-ui
|
||||||
|
```
|
||||||
|
|
||||||
|
Will start nginx with swagger-ui on port 80.
|
||||||
|
|
||||||
##### Prerequisites
|
##### Prerequisites
|
||||||
- Node 6.x
|
- Node 6.x
|
||||||
- NPM 3.x
|
- NPM 3.x
|
||||||
|
|||||||
Vendored
+22
-22
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AA6OA;;;;;;AAoIA;AAm7FA;AAwtCA;AAg0IA;;;;;AAkxBA;AAo8IA;AA41GA;AA23FA;AAmqFA;AA0nFA;AA49CA;AAwhDA;AAkrCA;AAumFA;AAmnHA;;;;;;;;;;;;;;AAqjHA;AAyoIA;AAkuJA;AAilHA;AA4kGA;AAwkEA;AAs3DA;AAovDA;AAotBA;AAoqGA;;;;;;AAueA;AAimGA;AA44EA;;;;;AAoGA;AA2qFA;AAo2CA;AAgvDA;AA8tCA;AAoiEA;AA69FA;;;;;;;;;AA20BA;AA2zIA;AAm4DA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AAoOA;;;;;;AAoIA;AAm7FA;AAwtCA;AAg0IA;;;;;AAkxBA;AA+7IA;AAi2GA;AA43FA;AA6oFA;AAipFA;AA+9CA;AA0gDA;AA0rCA;AA80EA;AAs4HA;;;;;;;;;;;;;;AA8kHA;AAyoIA;AAkuJA;AAilHA;AA4kGA;AAwkEA;AAs3DA;AAovDA;AA0tBA;AA+pGA;;;;;;AAseA;AAimGA;AA44EA;;;;;AAoGA;AA2qFA;AAm2CA;AAmvDA;AAwtCA;AAuiEA;AA29FA;;;;;;;;;AA00BA;AA2zIA;AAm4DA","sourceRoot":""}
|
||||||
Vendored
+3
-15
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AAwSA;AAyiGA;AAqwFA;;;;;;AA4eA;AAkvFA;AAu+CA;AAo+CA;AAgrCA;AAgyEA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AAwSA;AAyiGA","sourceRoot":""}
|
||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+8
-8
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAooGA;AAw0HA;AAijGA;AA6lCA;AA29BA;AAmwCA;AAw4BA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAqnGA;AAi2HA;AA6+FA;AAgqCA;AAi+BA;AAyvCA;AA84BA","sourceRoot":""}
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 8080;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
if ($request_method = 'OPTIONS') {
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||||
|
#
|
||||||
|
# Custom headers and headers various browsers *should* be OK with but aren't
|
||||||
|
#
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||||
|
#
|
||||||
|
# Tell client that this pre-flight info is valid for 20 days
|
||||||
|
#
|
||||||
|
add_header 'Access-Control-Max-Age' 1728000;
|
||||||
|
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||||
|
add_header 'Content-Length' 0;
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
if ($request_method = 'POST') {
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||||
|
}
|
||||||
|
if ($request_method = 'GET') {
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "swagger-ui",
|
"name": "swagger-ui",
|
||||||
"version": "3.0.0",
|
"version": "3.0.2",
|
||||||
"main": "dist/swagger-ui.js",
|
"main": "dist/swagger-ui.js",
|
||||||
"repository": "git@github.com:swagger-api/swagger-ui.git",
|
"repository": "git@github.com:swagger-api/swagger-ui.git",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
],
|
],
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "http-server -i -a 0.0.0.0 -p 3001",
|
|
||||||
"build": "npm run build-core && npm run build-bundle && npm run build-standalone",
|
"build": "npm run build-core && npm run build-bundle && npm run build-standalone",
|
||||||
"build-bundle": "webpack --config webpack-dist-bundle.config.js --colors",
|
"build-bundle": "webpack --config webpack-dist-bundle.config.js --colors",
|
||||||
"build-core": "webpack --config webpack-dist.config.js --colors",
|
"build-core": "webpack --config webpack-dist.config.js --colors",
|
||||||
@@ -63,7 +62,8 @@
|
|||||||
"redux-logger": "*",
|
"redux-logger": "*",
|
||||||
"reselect": "2.5.3",
|
"reselect": "2.5.3",
|
||||||
"serialize-error": "2.0.0",
|
"serialize-error": "2.0.0",
|
||||||
"swagger-client": "^3.0.1",
|
"shallowequal": "0.2.2",
|
||||||
|
"swagger-client": "^3.0.2",
|
||||||
"whatwg-fetch": "0.11.1",
|
"whatwg-fetch": "0.11.1",
|
||||||
"worker-loader": "^0.7.1",
|
"worker-loader": "^0.7.1",
|
||||||
"xml": "1.0.1",
|
"xml": "1.0.1",
|
||||||
@@ -102,7 +102,6 @@
|
|||||||
"react-hot-loader": "^1.3.1",
|
"react-hot-loader": "^1.3.1",
|
||||||
"rimraf": "^2.6.0",
|
"rimraf": "^2.6.0",
|
||||||
"sass-loader": "^6.0.2",
|
"sass-loader": "^6.0.2",
|
||||||
"shallowequal": "0.2.2",
|
|
||||||
"standard": "^8.6.0",
|
"standard": "^8.6.0",
|
||||||
"standard-loader": "^5.0.0",
|
"standard-loader": "^5.0.0",
|
||||||
"style-loader": "0.13.0",
|
"style-loader": "0.13.0",
|
||||||
|
|||||||
@@ -20,21 +20,23 @@ export default class LiveResponse extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let { request, response, getComponent } = this.props
|
const { request, response, getComponent } = this.props
|
||||||
|
|
||||||
|
const body = response.get("text")
|
||||||
|
const status = response.get("status")
|
||||||
|
const url = response.get("url")
|
||||||
|
const headers = response.get("headers").toJS()
|
||||||
|
const notDocumented = response.get("notDocumented")
|
||||||
|
const isError = response.get("error")
|
||||||
|
|
||||||
|
const headersKeys = Object.keys(headers)
|
||||||
|
const contentType = headers["content-type"]
|
||||||
|
|
||||||
const Curl = getComponent("curl")
|
const Curl = getComponent("curl")
|
||||||
let body = response.get("text")
|
const ResponseBody = getComponent("responseBody")
|
||||||
let status = response.get("status")
|
const returnObject = headersKeys.map(key => {
|
||||||
let url = response.get("url")
|
|
||||||
let originalHeaders = response.get("headers")
|
|
||||||
let headers = originalHeaders && originalHeaders.toJS()
|
|
||||||
let headersKeys = Object.keys(headers)
|
|
||||||
let returnObject = headersKeys.map(key => {
|
|
||||||
return <span className="headerline" key={key}> {key}: {headers[key]} </span>
|
return <span className="headerline" key={key}> {key}: {headers[key]} </span>
|
||||||
})
|
})
|
||||||
let notDocumented = response.get("notDocumented")
|
|
||||||
let ResponseBody = getComponent("responseBody")
|
|
||||||
let contentType = headers && headers["content-type"]
|
|
||||||
let isError = response.get("error")
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export default class OnlineValidatorBadge extends React.Component {
|
|||||||
let { validatorUrl } = getConfigs()
|
let { validatorUrl } = getConfigs()
|
||||||
this.state = {
|
this.state = {
|
||||||
url: specSelectors.url(),
|
url: specSelectors.url(),
|
||||||
validatorUrl: validatorUrl
|
validatorUrl: validatorUrl || "https://online.swagger.io/validator"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ export default class OnlineValidatorBadge extends React.Component {
|
|||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
url: specSelectors.url(),
|
url: specSelectors.url(),
|
||||||
validatorUrl: validatorUrl
|
validatorUrl: validatorUrl || "https://online.swagger.io/validator"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,12 +59,6 @@ export default class Operations extends React.Component {
|
|||||||
</small>
|
</small>
|
||||||
}
|
}
|
||||||
|
|
||||||
<button className="expand-methods" title="Expand all methods">
|
|
||||||
<svg className="expand" width="20" height="20">
|
|
||||||
<use xlinkHref="#expand" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button className="expand-operation" title="Expand operation" onClick={() => layoutActions.show(isShownKey, !showTag)}>
|
<button className="expand-operation" title="Expand operation" onClick={() => layoutActions.show(isShownKey, !showTag)}>
|
||||||
<svg className="arrow" width="20" height="20">
|
<svg className="arrow" width="20" height="20">
|
||||||
<use xlinkHref={showTag ? "#large-arrow-down" : "#large-arrow"} />
|
<use xlinkHref={showTag ? "#large-arrow-down" : "#large-arrow"} />
|
||||||
|
|||||||
+22
-31
@@ -4,6 +4,7 @@ import System from "core/system"
|
|||||||
import ApisPreset from "core/presets/apis"
|
import ApisPreset from "core/presets/apis"
|
||||||
import * as AllPlugins from "core/plugins/all"
|
import * as AllPlugins from "core/plugins/all"
|
||||||
import { filterConfigs } from "plugins/configs"
|
import { filterConfigs } from "plugins/configs"
|
||||||
|
import { parseSeach } from "core/utils"
|
||||||
|
|
||||||
module.exports = function SwaggerUI(opts) {
|
module.exports = function SwaggerUI(opts) {
|
||||||
|
|
||||||
@@ -35,79 +36,69 @@ module.exports = function SwaggerUI(opts) {
|
|||||||
store: { },
|
store: { },
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = deepExtend({}, defaults, opts)
|
const constructorConfig = deepExtend({}, defaults, opts)
|
||||||
|
|
||||||
const storeConfigs = deepExtend({}, config.store, {
|
const storeConfigs = deepExtend({}, constructorConfig.store, {
|
||||||
system: {
|
system: {
|
||||||
configs: config.configs
|
configs: constructorConfig.configs
|
||||||
},
|
},
|
||||||
plugins: config.presets,
|
plugins: constructorConfig.presets,
|
||||||
state: {
|
state: {
|
||||||
layout: {
|
layout: {
|
||||||
layout: config.layout
|
layout: constructorConfig.layout
|
||||||
},
|
},
|
||||||
spec: {
|
spec: {
|
||||||
spec: "",
|
spec: "",
|
||||||
url: config.url
|
url: constructorConfig.url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
let inlinePlugin = ()=> {
|
let inlinePlugin = ()=> {
|
||||||
return {
|
return {
|
||||||
fn: config.fn,
|
fn: constructorConfig.fn,
|
||||||
components: config.components,
|
components: constructorConfig.components,
|
||||||
state: config.state,
|
state: constructorConfig.state,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var store = new System(storeConfigs)
|
var store = new System(storeConfigs)
|
||||||
store.register([config.plugins, inlinePlugin])
|
store.register([constructorConfig.plugins, inlinePlugin])
|
||||||
|
|
||||||
var system = store.getSystem()
|
var system = store.getSystem()
|
||||||
|
let queryConfig = parseSeach()
|
||||||
|
|
||||||
const downloadSpec = (configs) => {
|
const downloadSpec = (configs) => {
|
||||||
if(typeof config !== "object") {
|
if(typeof constructorConfig !== "object") {
|
||||||
return system
|
return system
|
||||||
}
|
}
|
||||||
|
|
||||||
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
|
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
|
||||||
let mergedConfig = deepExtend({}, config, configs, localConfig)
|
let mergedConfig = deepExtend({}, constructorConfig, localConfig, queryConfig)
|
||||||
store.setConfigs(filterConfigs(mergedConfig))
|
store.setConfigs(filterConfigs(mergedConfig))
|
||||||
|
|
||||||
if(typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
|
if(!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
|
||||||
system.specActions.updateUrl("")
|
system.specActions.updateUrl("")
|
||||||
system.specActions.updateLoadingStatus("success");
|
system.specActions.updateLoadingStatus("success");
|
||||||
system.specActions.updateSpec(JSON.stringify(mergedConfig.spec))
|
system.specActions.updateSpec(JSON.stringify(mergedConfig.spec))
|
||||||
} else if(mergedConfig.url) {
|
} else if(system.specActions.download && mergedConfig.url) {
|
||||||
system.specActions.updateUrl(mergedConfig.url)
|
system.specActions.updateUrl(mergedConfig.url)
|
||||||
system.specActions.download(mergedConfig.url)
|
system.specActions.download(mergedConfig.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mergedConfig.dom_id)
|
if(mergedConfig.dom_id) {
|
||||||
system.render(mergedConfig.dom_id, "App")
|
system.render(mergedConfig.dom_id, "App")
|
||||||
|
} else {
|
||||||
|
console.error("Skipped rendering: no `dom_id` was specified")
|
||||||
|
}
|
||||||
|
|
||||||
return system
|
return system
|
||||||
}
|
}
|
||||||
|
|
||||||
if (system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl(downloadSpec)) {
|
if (!system.specActions.getConfigByUrl || (system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl(downloadSpec))) {
|
||||||
return downloadSpec(config)
|
return downloadSpec(constructorConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (system.specActions.download && config.url) {
|
|
||||||
system.specActions.download(config.url)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(config.spec && typeof config.spec === "string")
|
|
||||||
system.specActions.updateSpec(config.spec)
|
|
||||||
|
|
||||||
if(config.dom_id) {
|
|
||||||
system.render(config.dom_id, "App")
|
|
||||||
} else {
|
|
||||||
console.error("Skipped rendering: no `dom_id` was specified")
|
|
||||||
}
|
|
||||||
|
|
||||||
return system
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add presets
|
// Add presets
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function downloadUrlPlugin (toolbox) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateLoadingStatus: (status) => {
|
updateLoadingStatus: (status) => {
|
||||||
let enums = [null, "loading", "failed", "success"]
|
let enums = [null, "loading", "failed", "success", "failedConfig"]
|
||||||
if(enums.indexOf(status) === -1) {
|
if(enums.indexOf(status) === -1) {
|
||||||
console.error(`Error: ${status} is not one of ${JSON.stringify(enums)}`)
|
console.error(`Error: ${status} is not one of ${JSON.stringify(enums)}`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,6 @@ export const executeRequest = (req) => ({fn, specActions, errActions}) => {
|
|||||||
specActions.setRequest(req.pathName, req.method, parsedRequest)
|
specActions.setRequest(req.pathName, req.method, parsedRequest)
|
||||||
|
|
||||||
return fn.execute(req)
|
return fn.execute(req)
|
||||||
.then( fn.serializeRes )
|
|
||||||
.then( res => specActions.setResponse(req.pathName, req.method, res))
|
.then( res => specActions.setResponse(req.pathName, req.method, res))
|
||||||
.catch( err => specActions.setResponse(req.pathName, req.method, { error: true, err: serializeError(err) } ) )
|
.catch( err => specActions.setResponse(req.pathName, req.method, { error: true, err: serializeError(err) } ) )
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ export default {
|
|||||||
result = res
|
result = res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure headers
|
||||||
|
result.headers = result.headers || {}
|
||||||
|
|
||||||
let newState = state.setIn( [ "responses", path, method ], fromJSOrdered(result) )
|
let newState = state.setIn( [ "responses", path, method ], fromJSOrdered(result) )
|
||||||
|
|
||||||
// ImmutableJS messes up Blob. Needs to reset its value.
|
// ImmutableJS messes up Blob. Needs to reset its value.
|
||||||
|
|||||||
@@ -549,3 +549,19 @@ export const getSampleSchema = (schema, contentType="", config={}) => {
|
|||||||
|
|
||||||
return JSON.stringify(memoizedSampleFromSchema(schema, config), null, 2)
|
return JSON.stringify(memoizedSampleFromSchema(schema, config), null, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const parseSeach = () => {
|
||||||
|
let map = {}
|
||||||
|
let search = window.location.search
|
||||||
|
|
||||||
|
if ( search != "" ) {
|
||||||
|
let params = search.substr(1).split("&");
|
||||||
|
|
||||||
|
for (let i in params) {
|
||||||
|
i = params[i].split("=");
|
||||||
|
map[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import YAML from "js-yaml"
|
import YAML from "js-yaml"
|
||||||
|
import { parseSeach } from "core/utils"
|
||||||
import yamlConfig from "../../../swagger-config.yaml"
|
import yamlConfig from "../../../swagger-config.yaml"
|
||||||
|
|
||||||
const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
|
const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
|
||||||
@@ -16,22 +17,6 @@ const parseYamlConfig = (yaml, system) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const parseSeach = () => {
|
|
||||||
let map = {}
|
|
||||||
let search = window.location.search
|
|
||||||
|
|
||||||
if ( search != "" ) {
|
|
||||||
let params = search.substr(1).split("&");
|
|
||||||
|
|
||||||
for (let i in params) {
|
|
||||||
i = params[i].split("=");
|
|
||||||
map[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default function configPlugin (toolbox) {
|
export default function configPlugin (toolbox) {
|
||||||
let { fn } = toolbox
|
let { fn } = toolbox
|
||||||
|
|||||||
@@ -2,13 +2,11 @@ import StandaloneLayout from './layout'
|
|||||||
import '../style/main.scss'
|
import '../style/main.scss'
|
||||||
|
|
||||||
import TopbarPlugin from "plugins/topbar"
|
import TopbarPlugin from "plugins/topbar"
|
||||||
import ConfigsPlugin from "plugins/configs"
|
|
||||||
|
|
||||||
// the Standalone preset
|
// the Standalone preset
|
||||||
|
|
||||||
let preset = [
|
let preset = [
|
||||||
TopbarPlugin,
|
TopbarPlugin,
|
||||||
ConfigsPlugin,
|
|
||||||
() => {
|
() => {
|
||||||
return {
|
return {
|
||||||
components: { StandaloneLayout }
|
components: { StandaloneLayout }
|
||||||
|
|||||||
@@ -67,12 +67,14 @@ export default class StandaloneLayout extends React.Component {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<div className="scheme-container">
|
<div className="scheme-container">
|
||||||
{ securityDefinitions &&
|
<Col className="schemes wrapper" mobile={12}>
|
||||||
<Col className="schemes wrapper" mobile={12}>
|
{ schemes && schemes.size ? (
|
||||||
{ schemes && schemes.size ? <Schemes schemes={ schemes } specActions={ specActions } /> : null }
|
<Schemes schemes={ schemes } specActions={ specActions } />
|
||||||
<AuthorizeBtn />
|
) : null }
|
||||||
</Col>
|
{ securityDefinitions ? (
|
||||||
}
|
<AuthorizeBtn />
|
||||||
|
) : null }
|
||||||
|
</Col>
|
||||||
</div>
|
</div>
|
||||||
<Row>
|
<Row>
|
||||||
<Col mobile={12} desktop={12} >
|
<Col mobile={12} desktop={12} >
|
||||||
|
|||||||
@@ -9,13 +9,18 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: rgba($_color-delete, .1);
|
background: rgba($_color-delete, .1);
|
||||||
|
|
||||||
|
.error-wrapper
|
||||||
|
{
|
||||||
|
margin: 0 0 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
.errors
|
.errors
|
||||||
{
|
{
|
||||||
h4
|
h4
|
||||||
{
|
{
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
margin: 0 0 10px 0;
|
margin: 0;
|
||||||
|
|
||||||
@include text_code();
|
@include text_code();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,6 +286,21 @@ body
|
|||||||
@include method($_color-get);
|
@include method($_color-get);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.opblock-patch
|
||||||
|
{
|
||||||
|
@include method($_color-patch);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.opblock-head
|
||||||
|
{
|
||||||
|
@include method($_color-head);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.opblock-options
|
||||||
|
{
|
||||||
|
@include method($_color-options);
|
||||||
|
}
|
||||||
|
|
||||||
&.opblock-deprecated
|
&.opblock-deprecated
|
||||||
{
|
{
|
||||||
opacity: .6;
|
opacity: .6;
|
||||||
|
|||||||
Reference in New Issue
Block a user