improvement: online.swagger.io -> validator.swagger.io (#5599)

This commit is contained in:
kyle
2019-09-09 21:33:23 -07:00
committed by GitHub
parent 7cae0d2bdf
commit 94c86d3d50
6 changed files with 12 additions and 12 deletions

View File

@@ -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

View File

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

View File

@@ -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: {},

View File

@@ -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"

View File

@@ -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 () {
@@ -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 () {
@@ -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

View File

@@ -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")