Merge branch 'master' into bug/3949-enum-selectable-values

This commit is contained in:
kyle
2017-11-29 19:45:36 -06:00
committed by GitHub
3 changed files with 7 additions and 10 deletions

View File

@@ -57,9 +57,6 @@ export default class ResponseBody extends React.Component {
(headers["Content-Description"] && (/File Transfer/i).test(headers["Content-Description"])) ||
(headers["content-description"] && (/File Transfer/i).test(headers["content-description"]))) {
let contentLength = headers["content-length"] || headers["Content-Length"]
if ( !(+contentLength) ) return null
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
if (!isSafari && "Blob" in window) {

View File

@@ -473,6 +473,9 @@ export const validateParam = (param, isXml, isOAS3 = false) => {
let required = param.get("required")
let paramDetails = isOAS3 ? param.get("schema") : param
if(!paramDetails) return errors
let maximum = paramDetails.get("maximum")
let minimum = paramDetails.get("minimum")
let type = paramDetails.get("type")
@@ -480,7 +483,7 @@ export const validateParam = (param, isXml, isOAS3 = false) => {
let maxLength = paramDetails.get("maxLength")
let minLength = paramDetails.get("minLength")
let pattern = paramDetails.get("pattern")
/*
If the parameter is required OR the parameter has a value (meaning optional, but filled in)
@@ -506,7 +509,7 @@ export const validateParam = (param, isXml, isOAS3 = false) => {
let err = validatePattern(value, pattern)
if (err) errors.push(err)
}
if (maxLength || maxLength === 0) {
let err = validateMaxLength(value, maxLength)
if (err) errors.push(err)

View File

@@ -321,14 +321,11 @@ describe("utils", function() {
}
it("should check the isOAS3 flag when validating parameters", function() {
// This should "skip" validation because there is no `schema.type` property
// This should "skip" validation because there is no `schema` property
// and we are telling `validateParam` this is an OAS3 spec
param = fromJS({
value: "",
required: true,
schema: {
notTheTypeProperty: "string"
}
required: true
})
result = validateParam( param, false, true )
expect( result ).toEqual( [] )