From 94c86d3d50c035813f06204881a3b2052bc80dcd Mon Sep 17 00:00:00 2001 From: kyle Date: Mon, 9 Sep 2019 21:33:23 -0700 Subject: [PATCH] improvement: `online.swagger.io` -> `validator.swagger.io` (#5599) --- docs/usage/configuration.md | 2 +- src/core/components/online-validator-badge.jsx | 4 ++-- src/core/index.js | 2 +- swagger-config.yaml | 2 +- test/components/online-validator-badge.jsx | 12 ++++++------ .../xss/anchor-target-rel/online-validator-badge.jsx | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/usage/configuration.md b/docs/usage/configuration.md index b118bef4701..2f7600eaae0 100644 --- a/docs/usage/configuration.md +++ b/docs/usage/configuration.md @@ -70,7 +70,7 @@ Parameter name | Docker variable | Description `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. `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. `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. -`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. +`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. `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 diff --git a/src/core/components/online-validator-badge.jsx b/src/core/components/online-validator-badge.jsx index 8f0f2f14ccd..8998edba282 100644 --- a/src/core/components/online-validator-badge.jsx +++ b/src/core/components/online-validator-badge.jsx @@ -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 }) } diff --git a/src/core/index.js b/src/core/index.js index c75dd1f0d73..c0aaae00fcd 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -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: {}, diff --git a/swagger-config.yaml b/swagger-config.yaml index 70d2719df54..c21819c7e87 100644 --- a/swagger-config.yaml +++ b/swagger-config.yaml @@ -1,4 +1,4 @@ --- url: "https://petstore.swagger.io/v2/swagger.json" dom_id: "#swagger-ui" -validatorUrl: "https://online.swagger.io/validator" \ No newline at end of file +validatorUrl: "https://validator.swagger.io/validator" diff --git a/test/components/online-validator-badge.jsx b/test/components/online-validator-badge.jsx index 60218425654..3d947b66603 100644 --- a/test/components/online-validator-badge.jsx +++ b/test/components/online-validator-badge.jsx @@ -21,11 +21,11 @@ describe("", 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("", 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("", 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 diff --git a/test/xss/anchor-target-rel/online-validator-badge.jsx b/test/xss/anchor-target-rel/online-validator-badge.jsx index 7b6b5736cd3..4445df8a172 100644 --- a/test/xss/anchor-target-rel/online-validator-badge.jsx +++ b/test/xss/anchor-target-rel/online-validator-badge.jsx @@ -23,7 +23,7 @@ describe(" 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")