js-dxtools / webpack-validator

Validates your webpack config with Joi
MIT License
295 stars 29 forks source link

Document each property #89

Open bebraw opened 8 years ago

bebraw commented 8 years ago

This is a huge task by itself. If Joi allows us to document properties, we should definitely do that. That would allow introspection and lead to new tools/services based on the schema (think editor plugins etc.).

bebraw commented 8 years ago

Looks like we need to wait Joi on this one. They have a rough specification for .describe(). Just missing implementation.

One way to cheat would be to port from Joi to JSON Schema. A big step, though. On the plus side then you get to use JSON Schema compatible tooling.

jonathanglasmeyer commented 8 years ago

I think this overlaps with the goal of webpack-explain. I think a "living" documentation that interpolates the values you supplied in a given config can be very helpful, i just haven't settled on the most elegant way to implement this. I don't really understand Joi.describe(), seems a bit half-baked to me and under-powered for this idea.

bebraw commented 8 years ago

@jonathanewerner Did you have a look at JSON Schema? I know it could be a little painful to go from Joi to that, but just maybe it would be fitting for all these tools. Standard etc.

jonathanglasmeyer commented 8 years ago

I did have a cursory look, but my first impression is that it'll only allow data-type related validations, which wouldn't allow dynamic validations like the ones introduced via joi 9 custom rules (i.e. implements checks for file path existence on disk, and arbitrary dynamic, run-time checks).

bebraw commented 8 years ago

Correct. Custom checks like that would have to be built on top of it.

jonathanglasmeyer commented 8 years ago

I'm not convinced then. Having one interface and one style of validation output is important for code clarity/complexity & one kind of output is 👍🏻 for UX.