-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistency with route configurations #39
Comments
Great question. This issue may give you some context. At the time I built this module, they didn't allow other implementations to be used within the validate config. With that said, I actually wouldn't mind changing the module to use the built in validate config, but I just haven't had time to update it. |
Understood. Thanks! |
With this ticket closed does that mean you won't end up moving to the built in config? Or will that go into a new ticket? |
I was going to create a new one, but I'll actually just leave this one open for some additional context |
Hi, I tried to write a plugin which would check if object given to From hapi.js /lib/route.js line: 260 internals.compileRule = function (rule) {
// null, undefined, true - anything allowed
// false - nothing allowed
// {...} - ... allowed
return (rule === false ? Joi.object({}).allow(null)
: typeof rule === 'function' ? rule
: !rule || rule === true ? null // false tested earlier
: Joi.compile(rule));
}; If you provide JSON schema as an object to standard
I will also open a ticket about this in hapi repository, but I will appreciate if you suggest any ideas how to achieve this in current version? |
For update. I asked in hapi repository and got an answer. It seems impossible according to hapijs/hapi#2967. |
I've been exploring a few different options for automatic schema validation and API documentation. I noticed both lout and hapi-swagger support the following configuration for routes:
But ratify seems to require a different type of configuration structure with everything under a plugins and then a ratify object.
Is there a reason for the different structure? Would it be possible to re-use the same structure that others use that don't specify the ratify plugin explicitly? I mostly just want an easy way to keep things consistent but have the option of changing out documentation and / or validations.
The text was updated successfully, but these errors were encountered: