Skip to content

Commit

Permalink
Merge pull request #2817 from bodnia/fix-2796
Browse files Browse the repository at this point in the history
#2796 disable validator (with badge) by removing it from config
  • Loading branch information
bodnia authored Mar 29, 2017
2 parents 374b361 + ded299d commit c38bf2a
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 60 deletions.
91 changes: 45 additions & 46 deletions dist/swagger-ui-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/swagger-ui-bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions dist/swagger-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/swagger-ui.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/core/components/online-validator-badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -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
})
}

Expand All @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c38bf2a

Please sign in to comment.