Merge branch 'master' of github.com:swagger-api/swagger-ui into ft/linting-and-testing
This commit is contained in:
@@ -54,6 +54,8 @@ To help with the migration, here are the currently known issues with 3.X. This l
|
|||||||
- The JSON Form Editor is not implemented.
|
- The JSON Form Editor is not implemented.
|
||||||
- Shebang URL support for operations is missing.
|
- Shebang URL support for operations is missing.
|
||||||
- Support for `collectionFormat` is partial.
|
- Support for `collectionFormat` is partial.
|
||||||
|
- l10n (translations) is not implemented.
|
||||||
|
- Relative path support for external files is not implemented.
|
||||||
|
|
||||||
|
|
||||||
## CORS Support
|
## CORS Support
|
||||||
|
|||||||
2
dist/swagger-ui-bundle.js
vendored
2
dist/swagger-ui-bundle.js
vendored
@@ -24,7 +24,7 @@
|
|||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
"use strict";function n(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function r(e){if(e instanceof t){var n=new t(e.length);return e.copy(n),n}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function o(e){var t=[];return e.forEach(function(e,a){"object"==typeof e&&null!==e?Array.isArray(e)?t[a]=o(e):n(e)?t[a]=r(e):t[a]=i({},e):t[a]=e}),t}var i=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e,t,a=arguments[0],s=Array.prototype.slice.call(arguments,1);return s.forEach(function(s){"object"!=typeof s||Array.isArray(s)||Object.keys(s).forEach(function(u){return t=a[u],e=s[u],e===a?void 0:"object"!=typeof e||null===e?void(a[u]=e):Array.isArray(e)?void(a[u]=o(e)):n(e)?void(a[u]=r(e)):"object"!=typeof t||null===t||Array.isArray(t)?void(a[u]=i({},e)):void(a[u]=i(t,e))})}),a}}).call(t,n(3).Buffer)},function(e,t,n){(function(e){/*!
|
"use strict";function n(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function r(e){if(e instanceof t){var n=new t(e.length);return e.copy(n),n}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function i(e){var t=[];return e.forEach(function(e,a){"object"==typeof e&&null!==e?Array.isArray(e)?t[a]=i(e):n(e)?t[a]=r(e):t[a]=o({},e):t[a]=e}),t}var o=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e,t,a=arguments[0],s=Array.prototype.slice.call(arguments,1);return s.forEach(function(s){"object"!=typeof s||Array.isArray(s)||Object.keys(s).forEach(function(u){return t=a[u],e=s[u],e===a?void 0:"object"!=typeof e||null===e?void(a[u]=e):Array.isArray(e)?void(a[u]=i(e)):n(e)?void(a[u]=r(e)):"object"!=typeof t||null===t||Array.isArray(t)?void(a[u]=o({},e)):void(a[u]=o(t,e))})}),a}}).call(t,n(3).Buffer)},function(e,t,n){(function(e){/*!
|
||||||
* The buffer module from node.js, for the browser.
|
* The buffer module from node.js, for the browser.
|
||||||
*
|
*
|
||||||
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
||||||
|
|||||||
@@ -127,8 +127,12 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
|||||||
|
|
||||||
if (xml.wrapped) {
|
if (xml.wrapped) {
|
||||||
res[displayName] = []
|
res[displayName] = []
|
||||||
if (Array.isArray(defaultValue)) {
|
if (Array.isArray(example)) {
|
||||||
|
example.forEach((v)=>{
|
||||||
|
items.example = v
|
||||||
|
res[displayName].push(sampleXmlFromSchema(items, config))
|
||||||
|
})
|
||||||
|
} else if (Array.isArray(defaultValue)) {
|
||||||
defaultValue.forEach((v)=>{
|
defaultValue.forEach((v)=>{
|
||||||
items.default = v
|
items.default = v
|
||||||
res[displayName].push(sampleXmlFromSchema(items, config))
|
res[displayName].push(sampleXmlFromSchema(items, config))
|
||||||
@@ -145,14 +149,20 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
|||||||
|
|
||||||
let _res = []
|
let _res = []
|
||||||
|
|
||||||
if (Array.isArray(defaultValue)) {
|
if (Array.isArray(example)) {
|
||||||
|
example.forEach((v)=>{
|
||||||
|
items.example = v
|
||||||
|
_res.push(sampleXmlFromSchema(items, config))
|
||||||
|
})
|
||||||
|
return _res
|
||||||
|
} else if (Array.isArray(defaultValue)) {
|
||||||
defaultValue.forEach((v)=>{
|
defaultValue.forEach((v)=>{
|
||||||
items.default = v
|
items.default = v
|
||||||
_res.push(sampleXmlFromSchema(items, config))
|
_res.push(sampleXmlFromSchema(items, config))
|
||||||
})
|
})
|
||||||
return _res
|
return _res
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sampleXmlFromSchema(items, config)
|
return sampleXmlFromSchema(items, config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +186,13 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
|||||||
} else {
|
} else {
|
||||||
props[propName].xml.name = props[propName].xml.name || propName
|
props[propName].xml.name = props[propName].xml.name || propName
|
||||||
props[propName].example = props[propName].example !== undefined ? props[propName].example : example[propName]
|
props[propName].example = props[propName].example !== undefined ? props[propName].example : example[propName]
|
||||||
res[displayName].push(sampleXmlFromSchema(props[propName]))
|
let t = sampleXmlFromSchema(props[propName])
|
||||||
|
if (Array.isArray(t)) {
|
||||||
|
res[displayName] = res[displayName].concat(t)
|
||||||
|
} else {
|
||||||
|
res[displayName].push(t)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns array with default values with wrapped=true", function () {
|
it("returns array with default values with wrapped=true", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>one</animal>\n</animals>"
|
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
|
||||||
var definition = {
|
var definition = {
|
||||||
items: {
|
items: {
|
||||||
"enum": ["one", "two"],
|
"enum": ["one", "two"],
|
||||||
@@ -405,6 +405,7 @@ describe("createXMLExample", function () {
|
|||||||
name: "animal"
|
name: "animal"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"default": ["1", "2"],
|
||||||
xml: {
|
xml: {
|
||||||
wrapped: true,
|
wrapped: true,
|
||||||
name: "animals"
|
name: "animals"
|
||||||
@@ -413,8 +414,53 @@ describe("createXMLExample", function () {
|
|||||||
|
|
||||||
expect(sut(definition)).toEqual(expected)
|
expect(sut(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("returns array with example values with ", function () {
|
||||||
|
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
|
||||||
|
var definition = {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
"animal": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": [
|
||||||
|
"1",
|
||||||
|
"2"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
xml: {
|
||||||
|
name: "animals"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(sut(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("returns array with example values with wrapped=true", function () {
|
||||||
|
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
|
||||||
|
var definition = {
|
||||||
|
type: "array",
|
||||||
|
items: {
|
||||||
|
type: "string",
|
||||||
|
xml: {
|
||||||
|
name: "animal"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"example": [ "1", "2" ],
|
||||||
|
xml: {
|
||||||
|
wrapped: true,
|
||||||
|
name: "animals"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(sut(definition)).toEqual(expected)
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
describe("object", function () {
|
describe("object", function () {
|
||||||
it("returns object with 2 properties", function () {
|
it("returns object with 2 properties", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
|
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
|
||||||
|
|||||||
Reference in New Issue
Block a user