Skip to content

Breaking change with query string validation from 8.6.0 to 9.0.2 #2718

@dynajoe

Description

@dynajoe

I'm receiving a validation failure for requests that worked before upgrading from 8.6.0 to 9.0.2.

The validation that previously worked for query strings of the form ?sensor.battery.eq=4.02:

query: Joi.object({
   type: Joi.string()
}).pattern(/sensor\.[a-z0-9_]+\.(gte|gt|lte|lt|ne|eq)/i, Joi.number())

This is no longer valid after the upgrade. I get the error:

{"statusCode":400,"error":"Bad Request","message":"\\"sensor\\" is not allowed","validation":{"source":"query","keys":["sensor"]}}

in 8.6.0 -- request.query was:

{ 'sensor.battery.eq': 4.02 }

In 9.0.2 -- request.query now looks like:

// request.query
{ sensor: { battery: { eq: '4.02' } } }

Metadata

Metadata

Assignees

Labels

breaking changesChange that can breaking existing code

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions