fastest-validator
fastest-validator copied to clipboard
Form generator from FV schema
Similar to #186, I would like to create a frontend module which can generate HTML forms based on the FV schema because it contains every information about the type of fields, valid values, default values, validators...etc. And before submitting I can use FV to validate the values.
But to create it, I need a method which resolves (shorthand formats) the FV schema to a full JSON.
@erfanium I think you should need something similar for fv-document-generator. Did you start to work on it?
@icebob https://github.com/icebob/fastest-validator/blob/master/lib/validator.js#L331 Isn't this what you are looking for?
Yeah, something similar, but would be good a function which traverse the whole schema and convert all of them. And I need another one which creates an object with the default values.
@icebob the first one I am working on in a separate repository. At the moment I stopped at solving problems with the properties $$type and $$root. I still need to improve the logic when parsing the schema recursively.
With default values, the fields are easy to implement if you add default values directly to the rules.