Merge branch 'master' into styling-fixes
This commit is contained in:
10
.editorconfig
Normal file
10
.editorconfig
Normal file
@@ -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
|
||||||
@@ -9,7 +9,7 @@ COPY nginx.conf /etc/nginx/
|
|||||||
|
|
||||||
# copy swagger files to the `/js` folder
|
# copy swagger files to the `/js` folder
|
||||||
ADD ./dist/ /usr/share/nginx/html/js
|
ADD ./dist/ /usr/share/nginx/html/js
|
||||||
ADD ./public/index.html /usr/share/nginx/html
|
ADD ./public/* /usr/share/nginx/html/
|
||||||
|
|
||||||
# change the folder structure
|
# change the folder structure
|
||||||
RUN sed -i 's/\.\.\/dist/js/g' /usr/share/nginx/html/index.html
|
RUN sed -i 's/\.\.\/dist/js/g' /usr/share/nginx/html/index.html
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## New!
|
## New!
|
||||||
|
|
||||||
This is the new version of swagger-ui, 3.x.
|
**This is the new version of swagger-ui, 3.x. Want to learn more? Check out our [FAQ](http://swagger.io/new-ui-faq/).**
|
||||||
|
|
||||||
For the older version of swagger-ui, refer to the [*2.x branch*](https://github.com/swagger-api/swagger-ui/tree/2.x).
|
For the older version of swagger-ui, refer to the [*2.x branch*](https://github.com/swagger-api/swagger-ui/tree/2.x).
|
||||||
|
|
||||||
@@ -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.1 | 2017-03-18 | 2.0 | [tag v3.0.1](https://github.com/swagger-api/swagger-ui/tree/v3.0.1) |
|
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) |
|
||||||
|
|||||||
44
dist/swagger-ui-bundle.js
vendored
44
dist/swagger-ui-bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui-bundle.js.map
vendored
2
dist/swagger-ui-bundle.js.map
vendored
@@ -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;AAqqFA;AA0nFA;AA49CA;AAwhDA;AAkrCA;AAumFA;AAmnHA;;;;;;;;;;;;;;AAqjHA;AAyoIA;AAkuJA;AAilHA;AA4kGA;AAwkEA;AAs3DA;AAovDA;AAotBA;AAoqGA;;;;;;AAueA;AAimGA;AA44EA;;;;;AAoGA;AA2qFA;AAo2CA;AAkvDA;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":""}
|
||||||
18
dist/swagger-ui-standalone-preset.js
vendored
18
dist/swagger-ui-standalone-preset.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui-standalone-preset.js.map
vendored
2
dist/swagger-ui-standalone-preset.js.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA0SA;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":""}
|
||||||
16
dist/swagger-ui.js
vendored
16
dist/swagger-ui.js
vendored
File diff suppressed because one or more lines are too long
3
dist/swagger-ui.js.map
vendored
3
dist/swagger-ui.js.map
vendored
@@ -1 +1,2 @@
|
|||||||
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAooGA;AA20HA;AAgjGA;AA6lCA;AAw+BA;AAkvCA;AAs5BA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAqnGA;AAi2HA;AA6+FA;AAgqCA;AAi+BA;AAyvCA;AA84BA","sourceRoot":""}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "swagger-ui",
|
"name": "swagger-ui",
|
||||||
"version": "3.0.1",
|
"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",
|
||||||
@@ -64,7 +63,7 @@
|
|||||||
"reselect": "2.5.3",
|
"reselect": "2.5.3",
|
||||||
"serialize-error": "2.0.0",
|
"serialize-error": "2.0.0",
|
||||||
"shallowequal": "0.2.2",
|
"shallowequal": "0.2.2",
|
||||||
"swagger-client": "^3.0.1",
|
"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",
|
||||||
|
|||||||
@@ -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"} />
|
||||||
|
|||||||
@@ -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)}`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 }
|
||||||
|
|||||||
@@ -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