Skip to content

Commit 67a26a0

Browse files
committed
fix(payload-schemas): add custom RegEx validation for 'email'
1 parent f2f7ffb commit 67a26a0

File tree

2 files changed

+213
-0
lines changed

2 files changed

+213
-0
lines changed
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
{
2+
"action": "requested",
3+
"check_suite": {
4+
"id": 118578174,
5+
"node_id": "MDEwOkNoZWNrU3VpdGUxMTg1NzgxNzQ=",
6+
"head_branch": "master",
7+
"head_sha": "f95f852bd8fca8fcc58a9a2d6c842781e32a215e",
8+
"status": "queued",
9+
"conclusion": null,
10+
"url": "https://api.github.com/repos/Codertocat/Hello-World/check-suites/118578174",
11+
"before": "6113728f27ae82c7b1a177c8d03f9e96e0adf246",
12+
"after": "f95f852bd8fca8fcc58a9a2d6c842781e32a215e",
13+
"pull_requests": [],
14+
"app": {
15+
"id": 29310,
16+
"node_id": "MDM6QXBwMjkzMTA=",
17+
"owner": {
18+
"login": "Octocoders",
19+
"id": 38302899,
20+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjM4MzAyODk5",
21+
"avatar_url": "https://avatars1.githubusercontent.com/u/38302899?v=4",
22+
"gravatar_id": "",
23+
"url": "https://api.github.com/users/Octocoders",
24+
"html_url": "https://github.com/Octocoders",
25+
"followers_url": "https://api.github.com/users/Octocoders/followers",
26+
"following_url": "https://api.github.com/users/Octocoders/following{/other_user}",
27+
"gists_url": "https://api.github.com/users/Octocoders/gists{/gist_id}",
28+
"starred_url": "https://api.github.com/users/Octocoders/starred{/owner}{/repo}",
29+
"subscriptions_url": "https://api.github.com/users/Octocoders/subscriptions",
30+
"organizations_url": "https://api.github.com/users/Octocoders/orgs",
31+
"repos_url": "https://api.github.com/users/Octocoders/repos",
32+
"events_url": "https://api.github.com/users/Octocoders/events{/privacy}",
33+
"received_events_url": "https://api.github.com/users/Octocoders/received_events",
34+
"type": "Organization",
35+
"site_admin": false
36+
},
37+
"name": "octocoders-linter",
38+
"description": "",
39+
"external_url": "https://octocoders.io",
40+
"html_url": "https://github.com/apps/octocoders-linter",
41+
"created_at": "2019-04-19T19:36:24Z",
42+
"updated_at": "2019-04-19T19:36:56Z",
43+
"permissions": {
44+
"administration": "write",
45+
"checks": "write",
46+
"contents": "write",
47+
"deployments": "write",
48+
"issues": "write",
49+
"members": "write",
50+
"metadata": "read",
51+
"organization_administration": "write",
52+
"organization_hooks": "write",
53+
"organization_plan": "read",
54+
"organization_projects": "write",
55+
"organization_user_blocking": "write",
56+
"pages": "write",
57+
"pull_requests": "write",
58+
"repository_hooks": "write",
59+
"repository_projects": "write",
60+
"statuses": "write",
61+
"team_discussions": "write",
62+
"vulnerability_alerts": "read"
63+
},
64+
"events": []
65+
},
66+
"created_at": "2019-05-15T15:20:33Z",
67+
"updated_at": "2019-05-15T15:20:33Z",
68+
"latest_check_runs_count": 0,
69+
"check_runs_url": "https://api.github.com/repos/Codertocat/Hello-World/check-suites/118578174/check-runs",
70+
"head_commit": {
71+
"id": "f95f852bd8fca8fcc58a9a2d6c842781e32a215e",
72+
"tree_id": "c3e6e174b68ce629340ca817d52393dcf0aed707",
73+
"message": "Add new gemfile",
74+
"timestamp": "2019-05-15T15:20:31Z",
75+
"author": {
76+
"name": "github-actions[bot]",
77+
"email": "41898282+github-actions[bot]@users.noreply.github.com",
78+
"username": "github-actions[bot]"
79+
},
80+
"committer": {
81+
"name": "GitHub",
82+
"email": "noreply@github.com",
83+
"username": "web-flow"
84+
}
85+
}
86+
},
87+
"repository": {
88+
"id": 186853002,
89+
"node_id": "MDEwOlJlcG9zaXRvcnkxODY4NTMwMDI=",
90+
"name": "Hello-World",
91+
"full_name": "Codertocat/Hello-World",
92+
"private": false,
93+
"owner": {
94+
"login": "Codertocat",
95+
"id": 21031067,
96+
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
97+
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
98+
"gravatar_id": "",
99+
"url": "https://api.github.com/users/Codertocat",
100+
"html_url": "https://github.com/Codertocat",
101+
"followers_url": "https://api.github.com/users/Codertocat/followers",
102+
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
103+
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
104+
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
105+
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
106+
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
107+
"repos_url": "https://api.github.com/users/Codertocat/repos",
108+
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
109+
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
110+
"type": "User",
111+
"site_admin": false
112+
},
113+
"html_url": "https://github.com/Codertocat/Hello-World",
114+
"description": null,
115+
"fork": false,
116+
"url": "https://api.github.com/repos/Codertocat/Hello-World",
117+
"forks_url": "https://api.github.com/repos/Codertocat/Hello-World/forks",
118+
"keys_url": "https://api.github.com/repos/Codertocat/Hello-World/keys{/key_id}",
119+
"collaborators_url": "https://api.github.com/repos/Codertocat/Hello-World/collaborators{/collaborator}",
120+
"teams_url": "https://api.github.com/repos/Codertocat/Hello-World/teams",
121+
"hooks_url": "https://api.github.com/repos/Codertocat/Hello-World/hooks",
122+
"issue_events_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/events{/number}",
123+
"events_url": "https://api.github.com/repos/Codertocat/Hello-World/events",
124+
"assignees_url": "https://api.github.com/repos/Codertocat/Hello-World/assignees{/user}",
125+
"branches_url": "https://api.github.com/repos/Codertocat/Hello-World/branches{/branch}",
126+
"tags_url": "https://api.github.com/repos/Codertocat/Hello-World/tags",
127+
"blobs_url": "https://api.github.com/repos/Codertocat/Hello-World/git/blobs{/sha}",
128+
"git_tags_url": "https://api.github.com/repos/Codertocat/Hello-World/git/tags{/sha}",
129+
"git_refs_url": "https://api.github.com/repos/Codertocat/Hello-World/git/refs{/sha}",
130+
"trees_url": "https://api.github.com/repos/Codertocat/Hello-World/git/trees{/sha}",
131+
"statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/statuses/{sha}",
132+
"languages_url": "https://api.github.com/repos/Codertocat/Hello-World/languages",
133+
"stargazers_url": "https://api.github.com/repos/Codertocat/Hello-World/stargazers",
134+
"contributors_url": "https://api.github.com/repos/Codertocat/Hello-World/contributors",
135+
"subscribers_url": "https://api.github.com/repos/Codertocat/Hello-World/subscribers",
136+
"subscription_url": "https://api.github.com/repos/Codertocat/Hello-World/subscription",
137+
"commits_url": "https://api.github.com/repos/Codertocat/Hello-World/commits{/sha}",
138+
"git_commits_url": "https://api.github.com/repos/Codertocat/Hello-World/git/commits{/sha}",
139+
"comments_url": "https://api.github.com/repos/Codertocat/Hello-World/comments{/number}",
140+
"issue_comment_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/comments{/number}",
141+
"contents_url": "https://api.github.com/repos/Codertocat/Hello-World/contents/{+path}",
142+
"compare_url": "https://api.github.com/repos/Codertocat/Hello-World/compare/{base}...{head}",
143+
"merges_url": "https://api.github.com/repos/Codertocat/Hello-World/merges",
144+
"archive_url": "https://api.github.com/repos/Codertocat/Hello-World/{archive_format}{/ref}",
145+
"downloads_url": "https://api.github.com/repos/Codertocat/Hello-World/downloads",
146+
"issues_url": "https://api.github.com/repos/Codertocat/Hello-World/issues{/number}",
147+
"pulls_url": "https://api.github.com/repos/Codertocat/Hello-World/pulls{/number}",
148+
"milestones_url": "https://api.github.com/repos/Codertocat/Hello-World/milestones{/number}",
149+
"notifications_url": "https://api.github.com/repos/Codertocat/Hello-World/notifications{?since,all,participating}",
150+
"labels_url": "https://api.github.com/repos/Codertocat/Hello-World/labels{/name}",
151+
"releases_url": "https://api.github.com/repos/Codertocat/Hello-World/releases{/id}",
152+
"deployments_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments",
153+
"created_at": "2019-05-15T15:19:25Z",
154+
"updated_at": "2019-05-15T15:19:27Z",
155+
"pushed_at": "2019-05-15T15:20:32Z",
156+
"git_url": "git://github.com/Codertocat/Hello-World.git",
157+
"ssh_url": "git@github.com:Codertocat/Hello-World.git",
158+
"clone_url": "https://github.com/Codertocat/Hello-World.git",
159+
"svn_url": "https://github.com/Codertocat/Hello-World",
160+
"homepage": null,
161+
"size": 0,
162+
"stargazers_count": 0,
163+
"watchers_count": 0,
164+
"language": null,
165+
"has_issues": true,
166+
"has_projects": true,
167+
"has_downloads": true,
168+
"has_wiki": true,
169+
"has_pages": true,
170+
"forks_count": 0,
171+
"mirror_url": null,
172+
"archived": false,
173+
"disabled": false,
174+
"open_issues_count": 1,
175+
"license": null,
176+
"forks": 0,
177+
"open_issues": 1,
178+
"watchers": 0,
179+
"default_branch": "master",
180+
"is_template": false,
181+
"topics": [],
182+
"visibility": "public",
183+
"web_commit_signoff_required": false
184+
},
185+
"sender": {
186+
"login": "Codertocat",
187+
"id": 21031067,
188+
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
189+
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
190+
"gravatar_id": "",
191+
"url": "https://api.github.com/users/Codertocat",
192+
"html_url": "https://github.com/Codertocat",
193+
"followers_url": "https://api.github.com/users/Codertocat/followers",
194+
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
195+
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
196+
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
197+
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
198+
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
199+
"repos_url": "https://api.github.com/users/Codertocat/repos",
200+
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
201+
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
202+
"type": "User",
203+
"site_admin": false
204+
},
205+
"installation": {
206+
"id": 957387,
207+
"node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uOTU3Mzg3"
208+
}
209+
}

payload-schemas/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export const ajv = new Ajv({
1111

1212
addFormats(ajv);
1313

14+
// TODO: improve this regex to cover our use-case:
15+
// https://github.com/ajv-validator/ajv-formats/blob/4dd65447575b35d0187c6b125383366969e6267e/src/formats.ts#L65
16+
ajv.addFormat("email", /.*/);
17+
1418
const schemaDir = resolve(__dirname, "api.github.com");
1519

1620
const requireSchema = (

0 commit comments

Comments
 (0)