Schema validation issue with nullable boolean

My question:
I am not sure why postman schema validation assert is failing.

Details (like screenshots):

Here is the test:
let jsonData = {

    "studentAssetExceeded": null,
    
}

var schema = {

            "type": "object",
            "properties": {
                 "studentAssetExceeded": {
                    "title": "StudentAssetExceeded",
                    "maxLength": 5,
                    "type": "boolean",
                    "nullable": true,
                    "description": "Student asset threshold exceeded.",
                    "x-lineageReferenceObject": "FAPR.S.ASSET.THOLD.EXC"
                }
            }

            
                
        }
pm.test('AUTO009 - The api request is schema compliant for post', () => {
    pm.expect(jsonData).to.have.jsonSchema(schema);
});

Test Result:
AUTO009 - The api request is schema compliant for post | AssertionError: expected data to satisfy schema but found following errors: data.studentAssetExceeded should be boolean

Is there any way to address this error that the schema validation is throwing? The property studentAssetExceeded is nullable boolean. The schema validation works for true or false but not for null which is a valid input value.

Postman uses JavaScript under the hood.

Pretty sure that Booleans are just “true” or “false”.

JavaScript Booleans (w3schools.com)

Pretty sure this extends to JSON Booleans as well.

JSON Data Types (w3schools.com)

I’m not a JavaScript expert, but Googling this seems to imply the above is true.

Don’t know how nullable works. Maybe try “null” enclosed in strings.

@asainju

Ignore the “null” in strings. It doesn’t work either.

You can make the type an array though, which accepts boolean or null.

This seems to work.

let jsonData = {

    "studentAssetExceeded": null
    
}
var schema = {

            "type": "object",
            "properties": {
                 "studentAssetExceeded": {
                    "title": "StudentAssetExceeded",
                    "maxLength": 5,
                    "type": ["boolean", "null"],
                    "description": "Student asset threshold exceeded.",
                    "x-lineageReferenceObject": "FAPR.S.ASSET.THOLD.EXC"
                }
            }

            
                
        }
pm.test('AUTO009 - The api request is schema compliant for post', () => {
    pm.expect(jsonData).to.have.jsonSchema(schema);
});