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
|
||||
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
|
||||
RUN sed -i 's/\.\.\/dist/js/g' /usr/share/nginx/html/index.html
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
## 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).
|
||||
|
||||
@@ -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
|
||||
------------------ | ------------ | -------------------------- | ----- | ------
|
||||
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.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) |
|
||||
|
||||
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",
|
||||
"version": "3.0.1",
|
||||
"version": "3.0.2",
|
||||
"main": "dist/swagger-ui.js",
|
||||
"repository": "git@github.com:swagger-api/swagger-ui.git",
|
||||
"contributors": [
|
||||
@@ -14,7 +14,6 @@
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"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-bundle": "webpack --config webpack-dist-bundle.config.js --colors",
|
||||
"build-core": "webpack --config webpack-dist.config.js --colors",
|
||||
@@ -64,7 +63,7 @@
|
||||
"reselect": "2.5.3",
|
||||
"serialize-error": "2.0.0",
|
||||
"shallowequal": "0.2.2",
|
||||
"swagger-client": "^3.0.1",
|
||||
"swagger-client": "^3.0.2",
|
||||
"whatwg-fetch": "0.11.1",
|
||||
"worker-loader": "^0.7.1",
|
||||
"xml": "1.0.1",
|
||||
|
||||
@@ -7,7 +7,7 @@ export default class OnlineValidatorBadge extends React.Component {
|
||||
let { validatorUrl } = getConfigs()
|
||||
this.state = {
|
||||
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({
|
||||
url: specSelectors.url(),
|
||||
validatorUrl: validatorUrl
|
||||
validatorUrl: validatorUrl || "https://online.swagger.io/validator"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -59,12 +59,6 @@ export default class Operations extends React.Component {
|
||||
</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)}>
|
||||
<svg className="arrow" width="20" height="20">
|
||||
<use xlinkHref={showTag ? "#large-arrow-down" : "#large-arrow"} />
|
||||
|
||||
@@ -4,6 +4,7 @@ import System from "core/system"
|
||||
import ApisPreset from "core/presets/apis"
|
||||
import * as AllPlugins from "core/plugins/all"
|
||||
import { filterConfigs } from "plugins/configs"
|
||||
import { parseSeach } from "core/utils"
|
||||
|
||||
module.exports = function SwaggerUI(opts) {
|
||||
|
||||
@@ -35,79 +36,69 @@ module.exports = function SwaggerUI(opts) {
|
||||
store: { },
|
||||
}
|
||||
|
||||
const config = deepExtend({}, defaults, opts)
|
||||
const constructorConfig = deepExtend({}, defaults, opts)
|
||||
|
||||
const storeConfigs = deepExtend({}, config.store, {
|
||||
const storeConfigs = deepExtend({}, constructorConfig.store, {
|
||||
system: {
|
||||
configs: config.configs
|
||||
configs: constructorConfig.configs
|
||||
},
|
||||
plugins: config.presets,
|
||||
plugins: constructorConfig.presets,
|
||||
state: {
|
||||
layout: {
|
||||
layout: config.layout
|
||||
layout: constructorConfig.layout
|
||||
},
|
||||
spec: {
|
||||
spec: "",
|
||||
url: config.url
|
||||
url: constructorConfig.url
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let inlinePlugin = ()=> {
|
||||
return {
|
||||
fn: config.fn,
|
||||
components: config.components,
|
||||
state: config.state,
|
||||
fn: constructorConfig.fn,
|
||||
components: constructorConfig.components,
|
||||
state: constructorConfig.state,
|
||||
}
|
||||
}
|
||||
|
||||
var store = new System(storeConfigs)
|
||||
store.register([config.plugins, inlinePlugin])
|
||||
store.register([constructorConfig.plugins, inlinePlugin])
|
||||
|
||||
var system = store.getSystem()
|
||||
let queryConfig = parseSeach()
|
||||
|
||||
const downloadSpec = (configs) => {
|
||||
if(typeof config !== "object") {
|
||||
if(typeof constructorConfig !== "object") {
|
||||
return system
|
||||
}
|
||||
|
||||
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
|
||||
let mergedConfig = deepExtend({}, config, configs, localConfig)
|
||||
let mergedConfig = deepExtend({}, constructorConfig, localConfig, queryConfig)
|
||||
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.updateLoadingStatus("success");
|
||||
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.download(mergedConfig.url)
|
||||
}
|
||||
|
||||
if(mergedConfig.dom_id)
|
||||
if(mergedConfig.dom_id) {
|
||||
system.render(mergedConfig.dom_id, "App")
|
||||
} else {
|
||||
console.error("Skipped rendering: no `dom_id` was specified")
|
||||
}
|
||||
|
||||
return system
|
||||
}
|
||||
|
||||
if (system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl(downloadSpec)) {
|
||||
return downloadSpec(config)
|
||||
if (!system.specActions.getConfigByUrl || (system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl(downloadSpec))) {
|
||||
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
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function downloadUrlPlugin (toolbox) {
|
||||
},
|
||||
|
||||
updateLoadingStatus: (status) => {
|
||||
let enums = [null, "loading", "failed", "success"]
|
||||
let enums = [null, "loading", "failed", "success", "failedConfig"]
|
||||
if(enums.indexOf(status) === -1) {
|
||||
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)
|
||||
}
|
||||
|
||||
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 { parseSeach } from "core/utils"
|
||||
import yamlConfig from "../../../swagger-config.yaml"
|
||||
|
||||
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) {
|
||||
let { fn } = toolbox
|
||||
|
||||
@@ -2,13 +2,11 @@ import StandaloneLayout from './layout'
|
||||
import '../style/main.scss'
|
||||
|
||||
import TopbarPlugin from "plugins/topbar"
|
||||
import ConfigsPlugin from "plugins/configs"
|
||||
|
||||
// the Standalone preset
|
||||
|
||||
let preset = [
|
||||
TopbarPlugin,
|
||||
ConfigsPlugin,
|
||||
() => {
|
||||
return {
|
||||
components: { StandaloneLayout }
|
||||
|
||||
@@ -9,13 +9,18 @@
|
||||
border-radius: 4px;
|
||||
background: rgba($_color-delete, .1);
|
||||
|
||||
.error-wrapper
|
||||
{
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
.errors
|
||||
{
|
||||
h4
|
||||
{
|
||||
font-size: 14px;
|
||||
|
||||
margin: 0 0 10px 0;
|
||||
margin: 0;
|
||||
|
||||
@include text_code();
|
||||
}
|
||||
|
||||
@@ -286,6 +286,21 @@ body
|
||||
@include method($_color-get);
|
||||
}
|
||||
|
||||
&.opblock-patch
|
||||
{
|
||||
@include method($_color-patch);
|
||||
}
|
||||
|
||||
&.opblock-head
|
||||
{
|
||||
@include method($_color-head);
|
||||
}
|
||||
|
||||
&.opblock-options
|
||||
{
|
||||
@include method($_color-options);
|
||||
}
|
||||
|
||||
&.opblock-deprecated
|
||||
{
|
||||
opacity: .6;
|
||||
|
||||
Reference in New Issue
Block a user