The @bitovi/sequelize-querystring-parser and @bitovi/objection-querystring-parser packages are returning errors and incorrect results when filtering on null values.
Below is a list of examples showing the http request and the response body:
Objection Issues
// 1. GET localhost:3000/students?filter[house][$ne]=null
{
"data": [] // all students should be returned (because none have a null house)
}
// 2. GET localhost:3000/students?filter[house][$nin]=Gryffindor,null
{
"data": [] // all non-Gryffindors should be returned
}
Sequelize Issues
// 3. GET localhost:3000/students?filter=equals(house,null)
{
"errors": "SQLITE_ERROR: no such column: hogwarts.0"
}
// 4. GET localhost:3000/students?filter=any(house,null)
{
"errors": "Cannot read properties of null (reading 'length')" // might be because of https://github.com/bitovi/querystring-parser/issues/32
}
// 5. GET localhost:3000/students?filter[house][$eq]=null
{
"errors": "SQLITE_ERROR: no such column: hogwarts.0"
}
// 6. GET localhost:3000/students?filter[house][$ne]=null
{
"errors": "SQLITE_ERROR: no such column: hogwarts.0"
}
// 7. GET localhost:3000/students?filter[house][$nin]=Gryffindor,null
{
"errors": "Invalid value { undefined: [ 'Gryffindor', null ] }"
}
The
@bitovi/sequelize-querystring-parser
and@bitovi/objection-querystring-parser
packages are returning errors and incorrect results when filtering on null values.Below is a list of examples showing the http request and the response body:
Objection Issues
Sequelize Issues
Steps to Reproduce
Acceptance Criteria
References