nlf / mudskipper

a resourceful router plugin for hapi
15 stars 3 forks source link

Sub Resource Validations Should Not Inherit Parent Resource Validators #12

Open joshua-mcginnis opened 10 years ago

joshua-mcginnis commented 10 years ago

Whenever POST /resource has a payload validator, the POST method on a sub-resource appears to inherit that validator. Note that I haven't tried other methods or other use-cases (sub_sub_resources, etc).

POST /resource/123/sub_resource should not be griping about a validator on POST /resource, but it does.

However this is fixed, we'll still want to be able to validate the id on a subResource.

Example: /resource/:id/sub_resource, we should be able to add a validator for :id to the sub_resource to ensure it is present, int, and all that jazz.

caagency/caa-api2#419

joshua-mcginnis commented 10 years ago

It looks like this also affects the auth: { scope: ... } config option.

A scope on /resource is being applied to /resource/:id/sub_resource.