I am considering creating some kind of evidence-based tool that could capture metadata from a Symfony2 instance FormTypeto reset the validation scheme as JSON, something like the following:
[
{
name: 'someFieldName',
value: '',
email: true
},
{
name: 'yetAnotherFieldName',
value: 'I have a default value',
required: true
}
]
The goal is to use it in front-end JS code (let’s say, React) in order to be able to set the same verification restrictions as much as possible ( requiredetc.).
However, Symfony is well-structured, and its Form component knows nothing about validation. Considering only the nominal case of a simple form for a start, how would this be done? How to compare the form with the scanned objects / objects that it refers to?