Hi, I am currently using swaggerize-express/-routes in a client project and find it to be really useful.
However, I have noticed that the property path is set incorrectly for nested objects on input validation. I.e. I have a swagger.json which contains sth. like the following (following the JSON API spec):
So any input JSON object is required to have data.type (string) and data.attributes (object).
When a validation for a nested property fails though, the "path" provided in the error details contains only the property name, not the full path – i.e. type instead of data.type or email instead of data.attributes.email.
Hi, I am currently using swaggerize-express/-routes in a client project and find it to be really useful.
However, I have noticed that the property path is set incorrectly for nested objects on input validation. I.e. I have a swagger.json which contains sth. like the following (following the JSON API spec):
So any input JSON object is required to have
data.type (string)
anddata.attributes (object)
.When a validation for a nested property fails though, the
"path"
provided in the errordetails
contains only the property name, not the full path – i.e.type
instead ofdata.type
oremail
instead ofdata.attributes.email
.This is the source line that looks like the chief culprit: https://github.com/krakenjs/swaggerize-routes/blob/910c3908b3986288c8b9f72870a9048bdeb535a0/lib/validator.js#L117
Is there a particular reason for replacing the original
detail.path
with theparameter.name
?Cheers and thanks a lot!