Now supports optional JSON schema validation for url params, query params, request body, and response body. To use, pass the JSON schema into the configuration like so:
var Product = resourceClient({
url: 'http://www.mysite.com/api/products/:_id',
// recommended that you ban unkown properties when testing.
banUnknownProperties: settings.env === 'test'
});
Product.action('update', {
method: 'PUT'
urlParamsSchema: require('./product/schemas/update/url_params.json')
queryParamsSchema: require('./product/schemas/update/query_params.json')
requestBodySchema: require('./product/schemas/update/request_body.json')
responseBodySchema: require('./product/schemas/update/response_body.json')
})
It will reject / error if request validation fails.
Now supports optional JSON schema validation for url params, query params, request body, and response body. To use, pass the JSON schema into the configuration like so:
It will reject / error if request validation fails.