Converted /taskStates, /attachments and /attachments/:id to all be backed by the validation system.
A few notes on the changes:
/attachments includes a contentType field. Rather then just making this an optional field, I figured the other routes could benefit from having this validation as well. Thus, I extended their schema to include a contentType: JSONContentType field.
To support validation for /attachments/:id, the validation mechanism was moved from a middleware to be done within the typed router setup. This was the result of the route params not being available in the middleware (https://github.com/expressjs/express/issues/3177).
This also has the dual effect of extending the validation for the /attachments route since the body has seen serialized by the time it reaches the validation code in the typed router, thus the file size and type can be validated.
How this was tested
I extended my postman collections to include test cases for the new routes and ran the old test cases for the other routes to ensure there were no regressions.
Relates to #184
Converted
/taskStates
,/attachments
and/attachments/:id
to all be backed by the validation system.A few notes on the changes:
/attachments
includes acontentType
field. Rather then just making this an optional field, I figured the other routes could benefit from having this validation as well. Thus, I extended their schema to include acontentType: JSONContentType
field./attachments/:id
, the validation mechanism was moved from a middleware to be done within the typed router setup. This was the result of the route params not being available in the middleware (https://github.com/expressjs/express/issues/3177)./attachments
route since the body has seen serialized by the time it reaches the validation code in the typed router, thus the file size and type can be validated.How this was tested I extended my postman collections to include test cases for the new routes and ran the old test cases for the other routes to ensure there were no regressions.
You can see all the test case cases here: https://www.postman.com/orbit-postman/workspace/orbit/overview