# Schema validation issue with nullable boolean

**URL:** <https://community.postman.com/t/schema-validation-issue-with-nullable-boolean/43837>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [February 10, 2023, 4:21pm UTC](https://community.postman.com/t/schema-validation-issue-with-nullable-boolean/43837 "2023-02-10T16:21:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asainju](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@asainju](https://community.postman.com/u/asainju)\
**Post date:** [February 10, 2023, 4:21pm UTC](https://community.postman.com/t/schema-validation-issue-with-nullable-boolean/43837/1 "2023-02-10T16:21:44Z")

</div>

_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.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [February 10, 2023, 5:08pm UTC](https://community.postman.com/t/schema-validation-issue-with-nullable-boolean/43837/2 "2023-02-10T17:08:58Z")

</div>

Postman uses JavaScript under the hood.

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

[JavaScript Booleans (w3schools.com)](https://www.w3schools.com/JS/js_booleans.asp)

Pretty sure this extends to JSON Booleans as well.

[JSON Data Types (w3schools.com)](https://www.w3schools.com/js/js_json_datatypes.asp)

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.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [February 10, 2023, 5:16pm UTC](https://community.postman.com/t/schema-validation-issue-with-nullable-boolean/43837/3 "2023-02-10T17:16:56Z")

</div>

@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.

```auto
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);
});

```
