Skip to content
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

Support Joi extensions #80

Open
WesTyler opened this issue Nov 22, 2016 · 5 comments
Open

Support Joi extensions #80

WesTyler opened this issue Nov 22, 2016 · 5 comments

Comments

@WesTyler
Copy link
Member

This is a forum to discuss support and implementation of Joi extensions.

In order to maintain a 1:1 api parity with Joi, we will eventually need some level of support for Joi extensions.

It's important to note in thinking about implementation that extensions do not modify the Joi module itself, but provide a new Joi instance to the consumer. Felicity will not be able to pick up extensions automagically through Joi because of this fact. So we will need some sort of dynamic behavior for example and entityFor around customized schema types/extensions.

@lamchakchan
Copy link
Contributor

lamchakchan commented Nov 28, 2016

Maybe we can support Joi extensions like Joi does and make Felicity extensible. Author of a Joi extension can also author a Felicity extension. We can create a new repo for felicity/contrib where all of that work does into. What I'm not sure is if extensions modifies or overrides any.describe.

@WesTyler
Copy link
Member Author

Yeah I'm not sure about that either. I'll do some digging.

@WesTyler
Copy link
Member Author

WesTyler commented Dec 7, 2016

Specifically take a look at supporting https://github.com/hapijs/joi-date-extensions first, since it is a Joi syntax that was deprecated in upgrading from Joi v9->v10.

@WesTyler
Copy link
Member Author

Once the extension API/convention is figured out, I'd like to remove joi-date-extensions from the dependencies and go back to using "vanilla" Joi.

@WesTyler
Copy link
Member Author

Per discussions with @danielo515 on #116, this could potentially be support through the use of a generate function provided by the extension via describe functionality. Perhaps something like

if (typeof Hoek.reach(schemaDescription, 'generate') === 'function') {
    return schemaDescription.generate();
}

return this._generate(rules);

@WesTyler WesTyler added this to the 2.2.0 milestone Jun 28, 2017
@WesTyler WesTyler modified the milestones: 2.2.0, 3.0.0 Sep 30, 2017
@WesTyler WesTyler removed this from the 3.0.0 milestone Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants