Skip to content

Commit f03d26f

Browse files
committed
add validators for description, github organization and emails
1 parent a0d485f commit f03d26f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

copier/questions/package_details.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ package_short_description:
1010
placeholder: Short description
1111
help: Short description of package
1212
when: "{{ template_profile != 'minimum' and AddPackageDetails }}"
13+
validator: >-
14+
{% if not package_short_description %}
15+
Package description cannot be empty
16+
{% endif %}
1317
keyword1:
1418
type: str
1519
placeholder: keyword1
@@ -25,16 +29,28 @@ github_organization:
2529
placeholder: "<my-github-organization>"
2630
help: Enter the name of your GitHub username or organization
2731
when: "{{ template_profile != 'minimum' and AddPackageDetails }}"
32+
validator: >-
33+
{% if not github_organization %}
34+
This field cannot be empty
35+
{% endif %}
2836
email:
2937
type: str
3038
placeholder: yourname@esciencecenter.nl
3139
help: What is your email address?
3240
when: "{{ template_profile != 'minimum' and AddPackageDetails }}"
41+
validator: >-
42+
{% if not (email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %}
43+
Please enter a valid email address
44+
{% endif %}
3345
code_of_conduct_email:
3446
type: str
3547
placeholder: yourname@esciencecenter.nl
3648
help: What is the email address cor code of conduct?
3749
when: "{{ template_profile != 'minimum' and AddPackageDetails }}"
50+
validator: >-
51+
{% if not (code_of_conduct_email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %}
52+
Please enter a valid email address
53+
{% endif %}
3854
copyright_holder:
3955
type: str
4056
placeholder: Netherlands eScience Center

0 commit comments

Comments
 (0)