Hapi: Remove joi validation when creating request podium events

Created on 29 Jun 2017  路  6Comments  路  Source: hapijs/hapi

Most helpful comment

Just leave it for me... hence why it is already assigned. I am still thinking how I want to implement this.

All 6 comments

If you can give a slight pointer on what needs to be removed this would very nice for newcomer to PR, what do you think?

I'd give it a shot!

While that would be awesome, I expect this to require changes to both podium and hapi, which might make it more complex than a typical new contributor issue. What changes those should be is also somewhat of a design decision. Does someone see a simpler path?

@devinivy oh I thought it was just removing some joi validation calls?

We can still validate the event but not validate the same events over and over.

I was thinking in something like this:

const finishEvent = new Podium.Event('finish'); //event was validated here

somePodiumInstance.registerEvent(finishEvent); //no need to validate since it is a Podium.Event instance.

somePodiumInstance.registerEvent('disconnect'); //validate this one as we already do

in request.js

internals.events = {
    finish: new Podium.Event('finish'),
    peek: new Podium.Event({ name: 'peek', spread: true }),
    disconnect: new Podium.Event('disconnect')
}

/*...*/

internals.Request = function (connection, req, res, options) {

    Podium.call(this, internals.events.finish, internals.events.peek, internals.events.disconnect);

    /*...*/

If everyone like this approach I can start by making a PR to podium to get this moving :P

Just leave it for me... hence why it is already assigned. I am still thinking how I want to implement this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RohovDmytro picture RohovDmytro  路  4Comments

taoeffect picture taoeffect  路  3Comments

jeremiahlee picture jeremiahlee  路  4Comments

midknight41 picture midknight41  路  4Comments

mahnunchik picture mahnunchik  路  4Comments