Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator field for the variable type #378

Open
K-Kumar-01 opened this issue Mar 29, 2021 · 4 comments
Open

Validator field for the variable type #378

K-Kumar-01 opened this issue Mar 29, 2021 · 4 comments
Labels
Need More Info ℹ️ Extra information is required Type: Feature Request 🛍️ New feature or request

Comments

@K-Kumar-01
Copy link
Collaborator

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

@dselman
Copy link
Sponsor Contributor

dselman commented Mar 29, 2021

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.

@K-Kumar-01
Copy link
Collaborator Author

@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

@jeromesimeon
Copy link
Member

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 jeromesimeon transferred this issue from accordproject/concerto Apr 11, 2021
@jeromesimeon
Copy link
Member

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

@jolanglinais jolanglinais added Need More Info ℹ️ Extra information is required Type: Feature Request 🛍️ New feature or request labels Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Need More Info ℹ️ Extra information is required Type: Feature Request 🛍️ New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants