-
Notifications
You must be signed in to change notification settings - Fork 238
Description
#916 has already pointed out issues with combining with express v5.
In my case, I've noticed that coercion is completely broken and then fails validation.
If an operation is defined with parameters such as
parameters: [
{
description: '',
in: 'query',
name: 'a_number',
type: 'number',
required: true
}
],
then with express v4 this request would be successfully validated.
curl -X 'GET' 'http://localhost:3099/v1/my_op?a_number=4'
But with express v5 you get
errors: [
{
path: 'a_number',
errorCode: 'type.openapi.requestValidation',
message: 'must be number',
location: 'query'
}
]
This is because the openapi-request-coerce updates the query object in place. But in express v5, query is a getter which returns a new object every time. Hence any coercion is lost.
I'm not sure if there's a straight forward fix for this.
But it would be helpful if the fact that currently express-openapi doesn't really support express v5 was documented somewhere.
Whether this is with peer dependency ranges or just in the README.md, anything would better than spending a few hours to realise what had actually broken.