markdown-transform icon indicating copy to clipboard operation
markdown-transform copied to clipboard

Validator field for the variable type

Open K-Kumar-01 opened this issue 4 years ago • 4 comments

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

K-Kumar-01 avatar Mar 29 '21 13:03 K-Kumar-01

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 avatar Mar 29 '21 14:03 dselman

@dselman I think I was a bit unclear. I am adding an image for the reference Issue 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

K-Kumar-01 avatar Mar 29 '21 15:03 K-Kumar-01

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

jeromesimeon avatar Mar 30 '21 22:03 jeromesimeon

Why do you need the regular expression in the slate value? What's the use case?

jeromesimeon avatar Aug 13 '21 17:08 jeromesimeon