Open aaronmccall opened 9 years ago
Sound good to me.
I think it would be better to have them nested under "mapping", as below.
plugins: {
'hapi-io': {
event: 'get-user',
mapping: {
query: ['foo','bar'],
payload: ['baz', 'qux']
}
}
}
I guess this mapping option should override the validation mapping completely? And if the user does not specify this option, then we use the validation mapping.
I'd be happy for you to submit a pull request!
Sounds good! Watch out for incoming code!
Looks good so far!
I was just thinking about some other possibilities, and would like your thoughts on them (no need to implement now)...
What do you think of the following two examples? I think the second example, is more inline with how you've implemented the mappings option.
mapping: {
headers: {
accept: {
value: 'application/hal+json'
}
},
query: {
returnType: {
src: 'myField'
}
}
}
mapping: {
headers: [
{
field: 'accept',
value: 'application/hal+json'
}
],
query: [
{
field: 'returnType',
source: 'myField'
}
]
}
It would be really useful to be able to provide a data[prop] to query/payload[prop] mapping without having to specify validators for all of them.
What about extending the hapi-io route config to allow the following:
OR
If you like the idea, I'd be happy to submit a PR for it.