From 0b4cef3ca858746fb48954f3aea2a3e8dbc9a03e Mon Sep 17 00:00:00 2001 From: Alexander Kogan Date: Sun, 2 Jul 2017 19:57:39 +0300 Subject: [PATCH 1/2] fixing tag order to be in the same order as definition file --- src/core/plugins/spec/selectors.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/plugins/spec/selectors.js b/src/core/plugins/spec/selectors.js index d8487e89..a4f94349 100644 --- a/src/core/plugins/spec/selectors.js +++ b/src/core/plugins/spec/selectors.js @@ -1,6 +1,6 @@ import { createSelector } from "reselect" import { sorters } from "core/utils" -import { fromJS, Set, Map, List } from "immutable" +import { fromJS, Set, Map, OrderedMap, List } from "immutable" const DEFAULT_TAG = "default" @@ -187,13 +187,16 @@ export const tagDetails = (state, tag) => { export const operationsWithTags = createSelector( operationsWithRootInherited, - operations => { + tags, + (operations, tags) => { return operations.reduce( (taggedMap, op) => { let tags = Set(op.getIn(["operation","tags"])) if(tags.count() < 1) return taggedMap.update(DEFAULT_TAG, List(), ar => ar.push(op)) return tags.reduce( (res, tag) => res.update(tag, List(), (ar) => ar.push(op)), taggedMap ) - }, Map()) + }, tags.reduce( (taggedMap, tag) => { + return taggedMap.set(tag.get("name"), List()) + } , OrderedMap())) } ) From 9b21b5c2debfd8268becefd33d0ccc1d8700543b Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Tue, 4 Jul 2017 09:58:34 -0700 Subject: [PATCH 2/2] Add try/catch for module asset require calls --- swagger-ui-dist-package/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/swagger-ui-dist-package/index.js b/swagger-ui-dist-package/index.js index f97c1c4d..35bf6c8d 100644 --- a/swagger-ui-dist-package/index.js +++ b/swagger-ui-dist-package/index.js @@ -1,3 +1,13 @@ -module.exports.SwaggerUIBundle = require("./swagger-ui-bundle.js") -module.exports.SwaggerUIStandalonePreset = require("./swagger-ui-standalone-preset.js") +try { + module.exports.SwaggerUIBundle = require("./swagger-ui-bundle.js") + module.exports.SwaggerUIStandalonePreset = require("./swagger-ui-standalone-preset.js") +} catch(e) { + // swallow the error if there's a problem loading the assets. + // allows this module to support providing the assets for browserish contexts, + // without exploding in a Node context. + // + // see https://github.com/swagger-api/swagger-ui/issues/3291#issuecomment-311195388 + // for more information. +} + module.exports.absolutePath = require("./absolute-path.js")