nlf / mudskipper

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

Fix config getting merged across hasOne/hasMany subroutes #14

Closed latentflip closed 9 years ago

latentflip commented 10 years ago

Not super excited about my tests for this, seemed a bit weird to add a whole other set of data just for one test, but I figured I'd commit anyway and we can discuss.

Basically because merge instead of applyDefaults was being used, if you had multiple hasOne configs on a route, the first one's config got merged up into the parent, and the second then inherited the config of the first.

latentflip commented 10 years ago

Also, unsure if this exactly the desired behaviour, as I'm not sure how merging the parent config and child config is supposed to happen exactly?

nlf commented 10 years ago

The original consideration was for path validation, but I went way too generic. I think the better thing to do here is probably going to be to drop the generic merge and only merge config.validation.path if it exists.. I've been meaning to make that change for some time now

nlf commented 10 years ago

See #12