Merge branch 'master' into bug/3102-unguarded-expressions
This commit is contained in:
@@ -22,7 +22,7 @@ The OpenAPI Specification has undergone 4 revisions since initial creation in 20
|
|||||||
|
|
||||||
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
|
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
|
||||||
------------------ | ------------ | -------------------------- | ----- | ------
|
------------------ | ------------ | -------------------------- | ----- | ------
|
||||||
3.0.17 | 2017-06-23 | 2.0 | [tag v3.0.17](https://github.com/swagger-api/swagger-ui/tree/v3.0.17) |
|
3.0.18 | 2017-07-07 | 2.0 | [tag v3.0.18](https://github.com/swagger-api/swagger-ui/tree/v3.0.18) |
|
||||||
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) |
|
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) |
|
||||||
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) |
|
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) |
|
||||||
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
|
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
|
||||||
@@ -143,7 +143,7 @@ parameterMacro | MUST be a function. Function to set default value to parameters
|
|||||||
modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable
|
modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable
|
||||||
docExpansion | Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing). The default is 'list'.
|
docExpansion | Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing). The default is 'list'.
|
||||||
displayOperationId | Controls the display of operationId in operations list. The default is `false`.
|
displayOperationId | Controls the display of operationId in operations list. The default is `false`.
|
||||||
displayRequestDuration | Controls the display of the request duration (in milliseconds) for `Try it out` requests. The default is `false`.
|
displayRequestDuration | Controls the display of the request duration (in milliseconds) for `Try it out` requests. The default is `false`.
|
||||||
|
|
||||||
### Plugins
|
### Plugins
|
||||||
|
|
||||||
|
|||||||
16
dist/swagger-ui-bundle.js
vendored
16
dist/swagger-ui-bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui-bundle.js.map
vendored
2
dist/swagger-ui-bundle.js.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;;;;;AAsyKA;;;;;;AAmqEA;;;;;;;;;;;;;;;;;;;;;;;;;;AA6nTA;;;;;;;;;;;;;;AAu8JA;;;;;;;;;AA8/mBA;;;;;AA6/PA;;;;;;AAqpVA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;;;;;AAsyKA;;;;;;AA8qEA;;;;;;;;;;;;;;;;;;;;;;;;;;AA6nTA;;;;;;;;;;;;;;AAu8JA;;;;;;;;;AAkgnBA;;;;;AAigQA;;;;;;AAqpVA","sourceRoot":""}
|
||||||
6
dist/swagger-ui-standalone-preset.js
vendored
6
dist/swagger-ui-standalone-preset.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui.css
vendored
2
dist/swagger-ui.css
vendored
File diff suppressed because one or more lines are too long
4
dist/swagger-ui.js
vendored
4
dist/swagger-ui.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui.js.map
vendored
2
dist/swagger-ui.js.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AAkoaA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AAopaA","sourceRoot":""}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "swagger-ui",
|
"name": "swagger-ui",
|
||||||
"version": "3.0.17",
|
"version": "3.0.18",
|
||||||
"main": "dist/swagger-ui.js",
|
"main": "dist/swagger-ui.js",
|
||||||
"repository": "git@github.com:swagger-api/swagger-ui.git",
|
"repository": "git@github.com:swagger-api/swagger-ui.git",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
"sanitize-html": "^1.14.1",
|
"sanitize-html": "^1.14.1",
|
||||||
"serialize-error": "2.0.0",
|
"serialize-error": "2.0.0",
|
||||||
"shallowequal": "0.2.2",
|
"shallowequal": "0.2.2",
|
||||||
"swagger-client": "3.0.16",
|
"swagger-client": "3.0.17",
|
||||||
"url-parse": "^1.1.8",
|
"url-parse": "^1.1.8",
|
||||||
"whatwg-fetch": "0.11.1",
|
"whatwg-fetch": "0.11.1",
|
||||||
"worker-loader": "^0.7.1",
|
"worker-loader": "^0.7.1",
|
||||||
|
|||||||
@@ -1 +1,5 @@
|
|||||||
module.exports = {};
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
require("autoprefixer")
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -49,10 +49,11 @@ export default class ParamBody extends PureComponent {
|
|||||||
let { specSelectors, pathMethod, param, isExecute, consumesValue="" } = props
|
let { specSelectors, pathMethod, param, isExecute, consumesValue="" } = props
|
||||||
let parameter = specSelectors ? specSelectors.getParameter(pathMethod, param.get("name")) : {}
|
let parameter = specSelectors ? specSelectors.getParameter(pathMethod, param.get("name")) : {}
|
||||||
let isXml = /xml/i.test(consumesValue)
|
let isXml = /xml/i.test(consumesValue)
|
||||||
|
let isJson = /json/i.test(consumesValue)
|
||||||
let paramValue = isXml ? parameter.get("value_xml") : parameter.get("value")
|
let paramValue = isXml ? parameter.get("value_xml") : parameter.get("value")
|
||||||
|
|
||||||
if ( paramValue !== undefined ) {
|
if ( paramValue !== undefined ) {
|
||||||
let val = !paramValue && !isXml ? "{}" : paramValue
|
let val = !paramValue && isJson ? "{}" : paramValue
|
||||||
this.setState({ value: val })
|
this.setState({ value: val })
|
||||||
this.onChange(val, {isXml: isXml, isEditBox: isExecute})
|
this.onChange(val, {isXml: isXml, isEditBox: isExecute})
|
||||||
} else {
|
} else {
|
||||||
@@ -79,8 +80,11 @@ export default class ParamBody extends PureComponent {
|
|||||||
_onChange = (val, isXml) => { (this.props.onChange || NOOP)(this.props.param, val, isXml) }
|
_onChange = (val, isXml) => { (this.props.onChange || NOOP)(this.props.param, val, isXml) }
|
||||||
|
|
||||||
handleOnChange = e => {
|
handleOnChange = e => {
|
||||||
let {consumesValue} = this.props
|
const {consumesValue} = this.props
|
||||||
this.onChange(e.target.value.trim(), {isXml: /xml/i.test(consumesValue)})
|
const isJson = /json/i.test(consumesValue)
|
||||||
|
const isXml = /xml/i.test(consumesValue)
|
||||||
|
const inputValue = isJson ? e.target.value.trim() : e.target.value
|
||||||
|
this.onChange(inputValue, {isXml})
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleIsEditBox = () => this.setState( state => ({isEditBox: !state.isEditBox}))
|
toggleIsEditBox = () => this.setState( state => ({isEditBox: !state.isEditBox}))
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export default class ParameterRow extends Component {
|
|||||||
{ param.get("name") }
|
{ param.get("name") }
|
||||||
{ !required ? null : <span style={{color: "red"}}> *</span> }
|
{ !required ? null : <span style={{color: "red"}}> *</span> }
|
||||||
</div>
|
</div>
|
||||||
<div className="parаmeter__type">{ param.get("type") } { itemType && `[${itemType}]` }</div>
|
<div className="parameter__type">{ param.get("type") } { itemType && `[${itemType}]` }</div>
|
||||||
<div className="parameter__in">({ param.get("in") })</div>
|
<div className="parameter__in">({ param.get("in") })</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { createSelector } from "reselect"
|
import { createSelector } from "reselect"
|
||||||
import { sorters } from "core/utils"
|
import { sorters } from "core/utils"
|
||||||
import { fromJS, Set, Map, List } from "immutable"
|
import { fromJS, Set, Map, OrderedMap, List } from "immutable"
|
||||||
|
|
||||||
const DEFAULT_TAG = "default"
|
const DEFAULT_TAG = "default"
|
||||||
|
|
||||||
@@ -187,13 +187,16 @@ export const tagDetails = (state, tag) => {
|
|||||||
|
|
||||||
export const operationsWithTags = createSelector(
|
export const operationsWithTags = createSelector(
|
||||||
operationsWithRootInherited,
|
operationsWithRootInherited,
|
||||||
operations => {
|
tags,
|
||||||
|
(operations, tags) => {
|
||||||
return operations.reduce( (taggedMap, op) => {
|
return operations.reduce( (taggedMap, op) => {
|
||||||
let tags = Set(op.getIn(["operation","tags"]))
|
let tags = Set(op.getIn(["operation","tags"]))
|
||||||
if(tags.count() < 1)
|
if(tags.count() < 1)
|
||||||
return taggedMap.update(DEFAULT_TAG, List(), ar => ar.push(op))
|
return taggedMap.update(DEFAULT_TAG, List(), ar => ar.push(op))
|
||||||
return tags.reduce( (res, tag) => res.update(tag, List(), (ar) => ar.push(op)), taggedMap )
|
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()))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -462,6 +462,12 @@ export const validateInteger = ( val ) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const validateFile = ( val ) => {
|
||||||
|
if ( val && !(val instanceof win.File) ) {
|
||||||
|
return "Value must be a file"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// validation of parameters before execute
|
// validation of parameters before execute
|
||||||
export const validateParam = (param, isXml) => {
|
export const validateParam = (param, isXml) => {
|
||||||
let errors = []
|
let errors = []
|
||||||
@@ -472,7 +478,9 @@ export const validateParam = (param, isXml) => {
|
|||||||
let stringCheck = type === "string" && !value
|
let stringCheck = type === "string" && !value
|
||||||
let arrayCheck = type === "array" && Array.isArray(value) && !value.length
|
let arrayCheck = type === "array" && Array.isArray(value) && !value.length
|
||||||
let listCheck = type === "array" && Im.List.isList(value) && !value.count()
|
let listCheck = type === "array" && Im.List.isList(value) && !value.count()
|
||||||
if ( required && (stringCheck || arrayCheck || listCheck) ) {
|
let fileCheck = type === "file" && !(value instanceof win.File)
|
||||||
|
|
||||||
|
if ( required && (stringCheck || arrayCheck || listCheck || fileCheck) ) {
|
||||||
errors.push("Required field is not provided")
|
errors.push("Required field is not provided")
|
||||||
return errors
|
return errors
|
||||||
}
|
}
|
||||||
@@ -505,7 +513,10 @@ export const validateParam = (param, isXml) => {
|
|||||||
errors.push({ index: index, error: err})
|
errors.push({ index: index, error: err})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else if ( type === "file" ) {
|
||||||
|
let err = validateFile(value)
|
||||||
|
if (!err) return errors
|
||||||
|
errors.push(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors
|
return errors
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ label
|
|||||||
input[type=text],
|
input[type=text],
|
||||||
input[type=password],
|
input[type=password],
|
||||||
input[type=search],
|
input[type=search],
|
||||||
input[type=email]
|
input[type=email],
|
||||||
|
input[type=file]
|
||||||
{
|
{
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ body
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.parаmeter__type
|
.parameter__type
|
||||||
{
|
{
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
module.exports.SwaggerUIBundle = require("./swagger-ui-bundle.js")
|
try {
|
||||||
module.exports.SwaggerUIStandalonePreset = require("./swagger-ui-standalone-preset.js")
|
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")
|
module.exports.absolutePath = require("./absolute-path.js")
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/* eslint-env mocha */
|
/* eslint-env mocha */
|
||||||
import expect from "expect"
|
import expect from "expect"
|
||||||
import { fromJS } from "immutable"
|
import { fromJS } from "immutable"
|
||||||
import { mapToList, validateNumber, validateInteger, validateParam } from "core/utils"
|
import { mapToList, validateNumber, validateInteger, validateParam, validateFile } from "core/utils"
|
||||||
|
import win from "core/window"
|
||||||
|
|
||||||
describe("utils", function(){
|
describe("utils", function(){
|
||||||
|
|
||||||
@@ -157,6 +158,19 @@ describe("utils", function(){
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("validateFile", function() {
|
||||||
|
let errorMessage = "Value must be a file"
|
||||||
|
|
||||||
|
it("validates against objects which are instances of 'File'", function() {
|
||||||
|
let fileObj = new win.File([], "Test File")
|
||||||
|
expect(validateFile(fileObj)).toBeFalsy()
|
||||||
|
expect(validateFile(null)).toBeFalsy()
|
||||||
|
expect(validateFile(undefined)).toBeFalsy()
|
||||||
|
expect(validateFile(1)).toEqual(errorMessage)
|
||||||
|
expect(validateFile("string")).toEqual(errorMessage)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe("validateParam", function() {
|
describe("validateParam", function() {
|
||||||
let param = null
|
let param = null
|
||||||
let result = null
|
let result = null
|
||||||
@@ -171,6 +185,16 @@ describe("utils", function(){
|
|||||||
expect( result ).toEqual( ["Required field is not provided"] )
|
expect( result ).toEqual( ["Required field is not provided"] )
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("validates required files", function() {
|
||||||
|
param = fromJS({
|
||||||
|
required: true,
|
||||||
|
type: "file",
|
||||||
|
value: undefined
|
||||||
|
})
|
||||||
|
result = validateParam( param, false )
|
||||||
|
expect( result ).toEqual( ["Required field is not provided"] )
|
||||||
|
})
|
||||||
|
|
||||||
it("validates required arrays", function() {
|
it("validates required arrays", function() {
|
||||||
param = fromJS({
|
param = fromJS({
|
||||||
required: true,
|
required: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user