Merge pull request #3959 from shockey/bug/oas3-parameter-without-schema

Correctly validate OAS3 parameters that lack a `schema`
This commit is contained in:
kyle
2017-11-28 22:59:31 -06:00
committed by GitHub
2 changed files with 7 additions and 7 deletions

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")

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( [] )