Thursday 29 December 2016

Elegantly validating HTTP PATCH request body in node

Disclaimer: this question is more about REST than it is node but I'm using node so I figured I would post it here anyway.I'm implementing a REST API using Koa. So far I have post and put implemented for a particular resource (using Joi for validation).So far I'm happy about all of this but now i'm moving on implementing PATCH for the ability to modify individual properties of a particular resource. I'm a bit thrown off because for post and put, my validation schema is required as a whole. For PATCH each individual schema holds true, but none of the other rules apply since i'm only updating a single property.How have some of you approached this?

Submitted December 29, 2016 at 08:50PM by SomeRandomBuddy

No comments:

Post a Comment