Skip to content

Commit 7049de6

Browse files
authored
v3.14.0 (#4492)
* v3.14.0 * fix: simplify config fetch interceptor implementation * add `loadRemoteConfig` flag to requests * v3.14.0
1 parent 8cef3ad commit 7049de6

File tree

11 files changed

+43
-104
lines changed

11 files changed

+43
-104
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The OpenAPI Specification has undergone 5 revisions since initial creation in 20
2222

2323
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes
2424
------------------ | ------------ | -------------------------- | -----
25-
3.13.5 | 2018-04-20 | 2.0, 3.0 | [tag v3.13.5](https://github.com/swagger-api/swagger-ui/tree/v3.13.5)
25+
3.14.0 | 2018-04-27 | 2.0, 3.0 | [tag v3.14.0](https://github.com/swagger-api/swagger-ui/tree/v3.14.0)
2626
3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21)
2727
2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10)
2828
2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5)

dist/swagger-ui-bundle.js

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-standalone-preset.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-standalone-preset.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swagger-ui",
3-
"version": "3.13.6",
3+
"version": "3.14.0",
44
"main": "dist/swagger-ui.js",
55
"repository": "[email protected]:swagger-api/swagger-ui.git",
66
"contributors": [

src/core/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ module.exports = function SwaggerUI(opts) {
173173

174174
let configUrl = queryConfig.config || constructorConfig.configUrl
175175

176-
if (!configUrl || !system.specActions.getConfigByUrl || system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl(configUrl, downloadSpec)) {
176+
if (!configUrl || !system.specActions.getConfigByUrl || system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl({
177+
url: configUrl,
178+
loadRemoteConfig: true,
179+
requestInterceptor: constructorConfig.requestInterceptor,
180+
responseInterceptor: constructorConfig.responseInterceptor,
181+
}, downloadSpec)) {
177182
return downloadSpec()
178183
}
179184

src/core/plugins/configs/spec-actions.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
import { parseYamlConfig } from "./helpers"
22

3-
export const downloadConfig = (url) => ({fn: { fetch }, getConfigs}) => {
4-
const { requestInterceptor, responseInterceptor } = getConfigs()
5-
let req = { url }
6-
if(requestInterceptor) {
7-
req = requestInterceptor(req)
8-
}
3+
export const downloadConfig = (req) => (system) => {
4+
const {fn: { fetch }} = system
5+
96
return fetch(req)
10-
.then(res => {
11-
if(res) {
12-
return responseInterceptor(res)
13-
}
14-
return res
15-
})
167
}
178

18-
export const getConfigByUrl = (configUrl, cb)=> ({ specActions }) => {
19-
if (configUrl) {
20-
return specActions.downloadConfig(configUrl).then(next, next)
9+
export const getConfigByUrl = (req, cb)=> ({ specActions }) => {
10+
if (req) {
11+
return specActions.downloadConfig(req).then(next, next)
2112
}
2213

2314
function next(res) {
2415
if (res instanceof Error || res.status >= 400) {
2516
specActions.updateLoadingStatus("failedConfig")
2617
specActions.updateLoadingStatus("failedConfig")
2718
specActions.updateUrl("")
28-
console.error(res.statusText + " " + configUrl)
19+
console.error(res.statusText + " " + req.url)
2920
cb(null)
3021
} else {
3122
cb(parseYamlConfig(res.text))

0 commit comments

Comments
 (0)