Skip to content

Commit

Permalink
improvement: online.swagger.io -> validator.swagger.io (#5599)
Browse files Browse the repository at this point in the history
  • Loading branch information
shockey authored Sep 10, 2019
1 parent 7cae0d2 commit 94c86d3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/usage/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Parameter name | Docker variable | Description
<a name="responseInterceptor"></a>`responseInterceptor` | _Unavailable_ | `Function=(a => a)`. MUST be a function. Function to intercept remote definition, "Try it out", and OAuth 2.0 responses. Accepts one argument responseInterceptor(response) and must return the modified response, or a Promise that resolves to the modified response.
<a name="showMutatedRequest"></a>`showMutatedRequest` | `SHOW_MUTATED_REQUEST` | `Boolean=true`. If set to `true`, uses the mutated request returned from a requestInterceptor to produce the curl command in the UI, otherwise the request before the requestInterceptor was applied is used.
<a name="supportedSubmitMethods"></a>`supportedSubmitMethods` | `SUPPORTED_SUBMIT_METHODS` | `Array=["get", "put", "post", "delete", "options", "head", "patch", "trace"]`. List of HTTP methods that have the "Try it out" feature enabled. An empty array disables "Try it out" for all operations. This does not filter the operations from the display.
<a name="validatorUrl"></a>`validatorUrl` | `VALIDATOR_URL` | `String="https://online.swagger.io/validator" OR null`. By default, Swagger UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it to `null` will disable validation.
<a name="validatorUrl"></a>`validatorUrl` | `VALIDATOR_URL` | `String="https://validator.swagger.io/validator" OR null`. By default, Swagger UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it to `null` will disable validation.
<a name="withCredentials"></a>`withCredentials` | `WITH_CREDENTIALS` | `Boolean=false` If set to `true`, enables passing credentials, [as defined in the Fetch standard](https://fetch.spec.whatwg.org/#credentials), in CORS requests that are sent by the browser. Note that Swagger UI cannot currently set cookies cross-domain (see [swagger-js#1163](https://github.com/swagger-api/swagger-js/issues/1163)) - as a result, you will have to rely on browser-supplied cookies (which this setting enables sending) that Swagger UI cannot control.

##### Macros
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/online-validator-badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class OnlineValidatorBadge extends React.Component {
let { validatorUrl } = getConfigs()
this.state = {
url: this.getDefinitionUrl(),
validatorUrl: validatorUrl === undefined ? "https://online.swagger.io/validator" : validatorUrl
validatorUrl: validatorUrl === undefined ? "https://validator.swagger.io/validator" : validatorUrl
}
}

Expand All @@ -36,7 +36,7 @@ export default class OnlineValidatorBadge extends React.Component {

this.setState({
url: this.getDefinitionUrl(),
validatorUrl: validatorUrl === undefined ? "https://online.swagger.io/validator" : validatorUrl
validatorUrl: validatorUrl === undefined ? "https://validator.swagger.io/validator" : validatorUrl
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function SwaggerUI(opts) {
docExpansion: "list",
maxDisplayedTags: null,
filter: null,
validatorUrl: "https://online.swagger.io/validator",
validatorUrl: "https://validator.swagger.io/validator",
oauth2RedirectUrl: `${window.location.protocol}//${window.location.host}/oauth2-redirect.html`,
configs: {},
custom: {},
Expand Down
2 changes: 1 addition & 1 deletion swagger-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
url: "https://petstore.swagger.io/v2/swagger.json"
dom_id: "#swagger-ui"
validatorUrl: "https://online.swagger.io/validator"
validatorUrl: "https://validator.swagger.io/validator"
12 changes: 6 additions & 6 deletions test/components/online-validator-badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ describe("<OnlineValidatorBadge/>", function () {

// Then
expect(wrapper.find("a").props().href).toEqual(
"https://online.swagger.io/validator/debug?url=swagger.json"
"https://validator.swagger.io/validator/debug?url=swagger.json"
)
expect(wrapper.find("ValidatorImage").length).toEqual(1)
expect(wrapper.find("ValidatorImage").props().src).toEqual(
"https://online.swagger.io/validator?url=swagger.json"
"https://validator.swagger.io/validator?url=swagger.json"
)
})
it("should encode a definition URL correctly", function () {
Expand All @@ -43,11 +43,11 @@ describe("<OnlineValidatorBadge/>", function () {

// Then
expect(wrapper.find("a").props().href).toEqual(
"https://online.swagger.io/validator/debug?url=http%3A%2F%2Fgoogle.com%2Fswagger.json"
"https://validator.swagger.io/validator/debug?url=http%3A%2F%2Fgoogle.com%2Fswagger.json"
)
expect(wrapper.find("ValidatorImage").length).toEqual(1)
expect(wrapper.find("ValidatorImage").props().src).toEqual(
"https://online.swagger.io/validator?url=http%3A%2F%2Fgoogle.com%2Fswagger.json"
"https://validator.swagger.io/validator?url=http%3A%2F%2Fgoogle.com%2Fswagger.json"
)
})
it.skip("should resolve a definition URL against the browser's location", function () {
Expand All @@ -67,11 +67,11 @@ describe("<OnlineValidatorBadge/>", function () {

// Then
expect(wrapper.find("a").props().href).toEqual(
"https://online.swagger.io/validator/debug?url=http%3A%2F%2Fgoogle.com%2Fswagger.json"
"https://validator.swagger.io/validator/debug?url=http%3A%2F%2Fgoogle.com%2Fswagger.json"
)
expect(wrapper.find("ValidatorImage").length).toEqual(1)
expect(wrapper.find("ValidatorImage").props().src).toEqual(
"https://online.swagger.io/validator?url=http%3A%2F%2Fgoogle.com%2Fswagger.json"
"https://validator.swagger.io/validator?url=http%3A%2F%2Fgoogle.com%2Fswagger.json"
)
})
// should resolve a definition URL against the browser's location
Expand Down
2 changes: 1 addition & 1 deletion test/xss/anchor-target-rel/online-validator-badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("<OnlineValidatorBadge/> Anchor Target Safety", function () {

// Then
expect(anchor.props().href).toEqual(
"https://online.swagger.io/validator/debug?url=swagger.json"
"https://validator.swagger.io/validator/debug?url=swagger.json"
)
expect(anchor.props().target).toEqual("_blank")
expect(anchor.props().rel || "").toInclude("noopener")
Expand Down

0 comments on commit 94c86d3

Please sign in to comment.