Validator field for the variable type
Feature Request 🛍️
Currently, the JSON schema that is generated by parsing a template does not contain any validator field for a particular variable. It would be really handy there is a validator key in the JSON object
Current object:
children:[...],
data:{
elementType: 'element type'
name: 'field name'
}
Requested :
children:[...],
data:{
elementType: 'element type'
name: 'field name'
validator:{}
}
Use Case
This would ensure the entering of bad data in the variable field in certain circumstances
The Concerto -> JSON Schema conversion does include regex and number bounds validation information. I'm not sure I understand the examples above, which don't appear to be JSON Schema.
@dselman
I think I was a bit unclear.
I am adding an image for the reference
Here we see that the type is variable
This particular JSON object we get in the slateValue(present in web-components) which I assume is done when we parse a template and then draft a clause for the template.
Now when we parse a variable that variable comes from a model. If a model field has some validator like:
asset Model{
o String field regex=<any regex expression>/
}
then I want that validator field to be present as a key in the data element. I wonder if this can be made possible
That's an interesting question. I'm unsure if anything needs to change in Concerto itself, possibly this is more of an issue for the markdown-transform. Also if we want other information passed to Slate, we will need to update the CiceroMark model here: https://github.com/accordproject/models/blob/master/src/markdown/ciceromark%400.3.1.cto
Why do you need the regular expression in the slate value? What's the use case?