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

add arbitrary validation of attribute values #10

Open
cs01 opened this issue Jul 7, 2017 · 0 comments
Open

add arbitrary validation of attribute values #10

cs01 opened this issue Jul 7, 2017 · 0 comments

Comments

@cs01
Copy link
Contributor

cs01 commented Jul 7, 2017

The attributes.json file builds in validation with key/value pairs, the value being a regular expression. It is desirable to include more complex information as the values of a requirement's attribute, such as yaml, to enable code generation from the requirement itself.

To enforce valid values, the attribute validators would need to allow constraints in addition to regular expressions, such as an arbitrary go callback function that accepts the value as an input (i.e. isValidYaml()).

I am thinking something like "value": {"regexp": ".*"} for regexps, or "value": {"validatorFn": "validYaml"}.

@aleb also suggested that it might make more sense to use make the attributes file a .go file so that function imports can be done natively and caught at compile-time (I like this idea), or consider yaml.

lbedford pushed a commit that referenced this issue Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant