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

feat: Make it valid for ORGS, LABELS, and PEOPLE to be empty #28

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ Change Log
This project adheres to Semantic Versioning (https://semver.org/).


2023-05-30
~~~~~~~~~~

* Make it valid for ORGS, LABELS, and PEOPLE to be empty. This was prompted
because we actually want LABELS to be empty as an intermediate step towards
removing label creation from openedx-webhooks.

2023-03-02
~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion repo_tools_data_schema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Schema for repo-tools-data.
"""

__version__ = '1.0'
__version__ = '1.1'

from .repo_tools_data_schema import validate_labels, validate_orgs, validate_people, validate_salesforce_export
115 changes: 62 additions & 53 deletions repo_tools_data_schema/repo_tools_data_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,52 +140,58 @@ def _check(d):
)

PEOPLE_SCHEMA = Schema(
{
And(github_username, not_data_key): And(
{
'name': not_empty_string,
'email': valid_email,
'agreement': valid_agreement,
Optional('institution'): not_empty_string,
Optional('is_robot'): True,
Optional('jira'): not_empty_string,
Optional('comments'): [str],
Optional('other_emails'): [valid_email],
Optional('before'): {
datetime.date: And(
{
Optional('agreement'): valid_agreement,
Optional('institution'): not_empty_string,
Optional('comments'): [str],
Optional('committer'): COMMITTER_SCHEMA,
},
check_institution,
),
Or(
{
And(github_username, not_data_key): And(
{
'name': not_empty_string,
'email': valid_email,
'agreement': valid_agreement,
Optional('institution'): not_empty_string,
Optional('is_robot'): True,
Optional('jira'): not_empty_string,
Optional('comments'): [str],
Optional('other_emails'): [valid_email],
Optional('before'): {
datetime.date: And(
{
Optional('agreement'): valid_agreement,
Optional('institution'): not_empty_string,
Optional('comments'): [str],
Optional('committer'): COMMITTER_SCHEMA,
},
check_institution,
),
},
Optional('beta'): bool,
Optional('contractor'): bool,
Optional('committer'): COMMITTER_SCHEMA,
Optional('email_ok'): bool,
},
Optional('beta'): bool,
Optional('contractor'): bool,
Optional('committer'): COMMITTER_SCHEMA,
Optional('email_ok'): bool,
},
check_institution,
),
}
check_institution,
),
},
{},
),
)

ORGS_SCHEMA = Schema(
{
str: {
Optional("name"): not_empty_string,
"agreement": Or("institution", "none"),
Optional("contractor"): bool,
Optional("committer"): bool,
Optional("internal-ghorgs"): [str],
Optional(Or("contact", "contact1", "contact2")): {
"name": not_empty_string,
"email": valid_email,
Or(
{
str: {
Optional("name"): not_empty_string,
"agreement": Or("institution", "none"),
Optional("contractor"): bool,
Optional("committer"): bool,
Optional("internal-ghorgs"): [str],
Optional(Or("contact", "contact1", "contact2")): {
"name": not_empty_string,
"email": valid_email,
},
},
},
}
{},
)
)


Expand All @@ -194,19 +200,22 @@ def color(s):


LABELS_SCHEMA = Schema(
{
str: Or(
# A label we don't want:
{
"delete": True,
},
# A label we want:
{
"color": color,
Optional("description"): str,
},
),
},
Or(
{
str: Or(
# A label we don't want:
{
"delete": True,
},
# A label we want:
{
"color": color,
Optional("description"): str,
},
),
},
{},
),
)


Expand Down