#2796 disable validator (with badge) by removing it from config

This commit is contained in:
Anna Bodnia
2017-03-29 12:36:38 +03:00
parent 374b3613d0
commit ded299d891
6 changed files with 59 additions and 60 deletions

View File

@@ -13,7 +13,7 @@ export default class OnlineValidatorBadge extends React.Component {
let { validatorUrl } = getConfigs()
this.state = {
url: specSelectors.url(),
validatorUrl: validatorUrl || "https://online.swagger.io/validator"
validatorUrl: validatorUrl === undefined ? "https://online.swagger.io/validator" : null
}
}
@@ -23,7 +23,7 @@ export default class OnlineValidatorBadge extends React.Component {
this.setState({
url: specSelectors.url(),
validatorUrl: validatorUrl || "https://online.swagger.io/validator"
validatorUrl: validatorUrl === undefined ? "https://online.swagger.io/validator" : null
})
}
@@ -33,7 +33,7 @@ export default class OnlineValidatorBadge extends React.Component {
if ( typeof spec === "object" && Object.keys(spec).length) return null
if (!this.state.url) {
if (!this.state.url || !this.state.validatorUrl) {
return null
}

View File

@@ -14,8 +14,8 @@ module.exports = function SwaggerUI(opts) {
spec: {},
url: "",
layout: "Layout",
validatorUrl: "https://online.swagger.io/validator",
configs: {
validatorUrl: "https://online.swagger.io/validator"
},
// Initial set of plugins ( TODO rename this, or refactor - we don't need presets _and_ plugins. Its just there for performance.