-
Notifications
You must be signed in to change notification settings - Fork 57
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
Proposal for refactor #72
Comments
Happy for any contributions but not sure why that includes switching test framework. Is that just because you are more comfortable with jest than tape? |
In addition, will this address some known issue? I read the issue you opened but it seems more based on principle than resolving any particular issue. i.e |
Mostly it's out of principle, yes. We had only 1 issue with {
oneOf: [...],
type: 'object',
properties: {...}
} This schema didn't care about anything after As you pointed out |
Thanks for the explanation. It’s rather surprising that the meta schema does not catch this (in general). |
Well I also only learned this by the github thread, not by the documentation itself. I agree documentation is vague on this topic and should be more explicit. |
So the question is do we want to enforce the correct behaviors and create more sane schemas or be as vague as the spec? |
I guess. At this point the choice is entirely yours. Since these problems we have switched to use |
And just to answer the question about the test framework. It is because it's hard to use |
That’s actually not true. Tape can run an arbitrary number of assertions and end a test with t.end(). However, planning your assertions also ensures the expectations of a test are met, and fail when they are not. Tests can be skipped, certain suites run only, etc. You can also execute single tests files since it doesn’t require a test runner. |
Here is a nice little write up that I generally agree with too: |
Accidentally closed, oops. Anyway I am not saying that changing the test framework is out of the question - but I’ve come to appreciate the simplicity and flexibility of tape and generally take a “if it ain’t broke don’t fix it” mentality on such changes. But if changing the testing framework is going to make it easier for contributors then maybe that’s a good thing too (I just personally think tape is easy enough to use). |
I guess it is my fault too, for not trying to more familiar with |
What is the states of the refactor? If major refactor of the code is done it would be nice if at the same moment #79 gets closed and joi version 16.X is supported. |
Currently the refactor is on pause. We have moved on to |
#79 is being planned soon. Also happy to see a PR. |
Also, I understand why you'd use |
If that is the purpose of |
I do, where possible and supported by |
I've started to work on it but there are a lot of breaking changes. I've asked for help with it but in absence of contribution it is a bit slower going than I would like.
Regarding that statement... This module is really designed for using JSON schema with hapi based servers. Hapi, to me, remains the best node.js framework for enterprise environments with large distributed teams. I would not characterize it as "old" ... That being said, fastify is a great framework to use if you don't need the benefits hapi provides. And yes, if you aren't using hapi you are less likely to need to use this module. |
While trying to better understand JSON Schema I ended up with this Q/A thread json-schema-org/json-schema-spec#733 which explained a lot in how JSON Schema validation should work.
Taking that into consideration I think
enjoi
is due for a major refactor. At the moment enjoy validates against e.g.required
andproperties
only if"type": "object"
. And all validation keywords should be independently taken into consideration and validated against.I am willing to work on this if you would consider a later PR. Also since it will be a major refactor would you consider me changing the testing library with
jest
. I've been using it for some time now and it's proven very flexible and versatile.The text was updated successfully, but these errors were encountered: