Skip to content

Commit 444efad

Browse files
authored
Spec Update 06/23/2021 (dropbox#44)
Change Notes: - Add release note generator script files Namespace - Update comments sharing_files Namespace - Update comments team_legal_holds Namespace - Update comments team_log_generated Namespace - Add InviteAcceptanceEmailPolicyChangedDetails, InviteAcceptanceEmailPolicyChangedType structs - Add InviteAcceptanceEmailPolicy unions - Update EventDetails union to include invite_acceptance_email_policy_changed_details - Update EventType union to include invite_acceptance_email_policy_changed, and invite_acceptance_email_policy_changed team_secondary_mails Namespace - Update comments
1 parent 9923a50 commit 444efad

File tree

6 files changed

+225
-9
lines changed

6 files changed

+225
-9
lines changed

files.stone

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2590,7 +2590,7 @@ route get_temporary_upload_link(GetTemporaryUploadLinkArg, GetTemporaryUploadLin
25902590
of the uploaded data in JSON format.
25912591

25922592

2593-
Example succesful temporary upload link consumption response:
2593+
Example successful temporary upload link consumption response:
25942594

25952595
{\"content-hash\": \"599d71033d700ac892a0e48fa61b125d2f5994\"}
25962596

release_note_generator.py

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
import os
2+
import re
3+
from enum import Enum
4+
from datetime import date
5+
from collections import defaultdict
6+
from sys import argv
7+
from typing import List, Optional, NamedTuple, Tuple
8+
from unidiff import PatchSet
9+
10+
class DataType(str, Enum):
11+
ROUTE = "route"
12+
STRUCT = "struct"
13+
UNION = "union"
14+
15+
NsChange = NamedTuple('NsChange', [
16+
('file_name', str),
17+
('added_routes', List[str]),
18+
('added_structs', List[str]),
19+
('added_unions', List[str]),
20+
('deprecated_routes', List[str]),
21+
('removed_routes', List[str]),
22+
('removed_structs', List[str]),
23+
('removed_unions', List[str]),
24+
('updated_datatypes', Optional[List[Tuple[str, DataType]]]),
25+
])
26+
27+
ChangeLog = NamedTuple('ChangeLog', [
28+
('ns_changes', List[NsChange]),
29+
('added_nses', List[str]),
30+
('removed_nses', List[str]),
31+
])
32+
33+
34+
def parse_datatype_info(line):
35+
# type: (str) -> Optional[Tuple[DataType, str]]
36+
route = re.match(r"^route (.+)\(", line)
37+
struct = re.match(r"^struct (.+)$", line)
38+
union = re.match(r"^union (.+)$", line)
39+
match = struct or union or route
40+
if not match:
41+
return None
42+
datatype = DataType.ROUTE
43+
if struct:
44+
datatype = DataType.STRUCT
45+
if union:
46+
datatype = DataType.UNION
47+
return datatype, match.group(1)
48+
49+
50+
def parse_change_log(change_log_diff):
51+
# type: (str) -> ChangeLog
52+
ns_changes = []
53+
added_nses = []
54+
removed_nses = []
55+
56+
patch = PatchSet(change_log_diff)
57+
for patch_file in patch:
58+
path_parts = patch_file.path.split('.')
59+
if len(path_parts) != 2:
60+
continue
61+
ns_file_name, ext = path_parts
62+
if ext != "stone":
63+
continue
64+
65+
if patch_file.is_added_file:
66+
added_nses.append(ns_file_name)
67+
continue
68+
69+
if patch_file.is_removed_file:
70+
removed_nses.append(ns_file_name)
71+
continue
72+
73+
added_routes = []
74+
added_structs = []
75+
added_unions = []
76+
deprecated_routes = []
77+
removed_routes = []
78+
removed_structs = []
79+
removed_unions = []
80+
updated_datatypes = []
81+
82+
route_map = defaultdict(int)
83+
84+
# Pass for checking for creation/deletion of datatypes
85+
for hunk in patch_file:
86+
for line in hunk:
87+
datatype_info = parse_datatype_info(line.value)
88+
if datatype_info is None:
89+
continue
90+
datatype, datatype_name = datatype_info
91+
92+
if datatype == DataType.ROUTE:
93+
if line.is_added:
94+
route_map[datatype_name] += 1
95+
if line.is_removed:
96+
route_map[datatype_name] -= 1
97+
98+
if datatype == DataType.STRUCT:
99+
if line.is_added:
100+
added_structs.append(datatype_name)
101+
if line.is_removed:
102+
removed_structs.append(datatype_name)
103+
104+
if datatype == DataType.UNION:
105+
if line.is_added:
106+
added_unions.append(datatype_name)
107+
if line.is_removed:
108+
removed_unions.append(datatype_name)
109+
110+
111+
datatype, datatype_name = None, None
112+
seen_datatypes = set()
113+
114+
# Pass to check for updated datatypes
115+
for line in hunk:
116+
datatype_info = parse_datatype_info(line.value)
117+
if datatype_info and not line.is_removed:
118+
if line.is_added:
119+
datatype, datatype_name = None, None
120+
else:
121+
datatype, datatype_name = datatype_info
122+
if not datatype_info and datatype and datatype_name:
123+
if line.is_removed or line.is_added and datatype_name not in seen_datatypes:
124+
updated_datatypes.append((datatype, datatype_name))
125+
seen_datatypes.add(datatype_name)
126+
127+
for route, ref_count in route_map.iteritems():
128+
if ref_count > 0:
129+
added_routes.append(route)
130+
if ref_count < 0:
131+
removed_routes.append(route)
132+
133+
ns_change = NsChange(
134+
ns_file_name,
135+
added_routes,
136+
added_structs,
137+
added_unions,
138+
deprecated_routes,
139+
removed_routes,
140+
removed_structs,
141+
removed_unions,
142+
updated_datatypes,
143+
)
144+
ns_changes.append(ns_change)
145+
146+
change_log = ChangeLog(ns_changes, added_nses, removed_nses)
147+
return change_log
148+
149+
150+
def main():
151+
stream = os.popen('git diff')
152+
diff = stream.read()
153+
change_log = parse_change_log(diff)
154+
print "Spec Update {} (#<TODO>)".format(date.today().strftime("%m/%d/%Y"))
155+
print
156+
print "Change Notes:"
157+
for ns_change in change_log.ns_changes:
158+
print
159+
print "{} Namespace".format(ns_change.file_name)
160+
if ns_change.added_routes:
161+
print "- Add {} routes".format(", ".join(ns_change.added_routes))
162+
if ns_change.added_structs:
163+
print "- Add {} structs".format(", ".join(ns_change.added_structs))
164+
if ns_change.added_unions:
165+
print "- Add {} unions".format(", ".join(ns_change.added_unions))
166+
if ns_change.removed_routes:
167+
print "- Remove {} routes".format(", ".join(ns_change.removed_routes))
168+
if ns_change.removed_structs:
169+
print "- Remove {} structs".format(", ".join(ns_change.removed_structs))
170+
if ns_change.removed_unions:
171+
print "- Remove {} unions".format(", ".join(ns_change.removed_unions))
172+
if ns_change.updated_datatypes:
173+
for datatype, datatype_name in ns_change.updated_datatypes:
174+
print "- Update {} {} to include/remove/deprecate <TODO>".format(datatype_name, datatype)
175+
if change_log.added_nses:
176+
print
177+
for ns in change_log.added_nses:
178+
print("Add {} namespace".format(ns))
179+
180+
if change_log.removed_nses:
181+
print
182+
for ns in change_log.removed_nses:
183+
print("Add {} namespace".format(ns))
184+
185+
186+
if __name__ == "__main__":
187+
main()
188+

sharing_files.stone

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ struct AddFileMemberArgs
261261

262262
members List(MemberSelector)
263263
"Members to add. Note that even an email address is given, this
264-
may result in a user being directy added to the membership if that
264+
may result in a user being directly added to the membership if that
265265
email is the user's main account email."
266266

267267
custom_message String?

team_legal_holds.stone

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct LegalHoldPolicy
4949
activation_time common.DropboxTimestamp?
5050
"The time at which the legal hold was activated."
5151
members MembersInfo
52-
"Team members IDs and number of permanetly deleted members under hold."
52+
"Team members IDs and number of permanently deleted members under hold."
5353
status LegalHoldStatus
5454
"The current state of the hold."
5555
start_date common.DropboxTimestamp

team_log_generated.stone

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,11 @@ union IntegrationPolicy
623623
disabled
624624
enabled
625625

626+
union InviteAcceptanceEmailPolicy
627+
"Policy for deciding whether team admins receive email when an invitation to join the team is accepted"
628+
disabled
629+
enabled
630+
626631
union LabelType
627632
"Label type"
628633
personal_information
@@ -5668,6 +5673,18 @@ struct IntegrationPolicyChangedDetails
56685673
new_value = disabled
56695674
previous_value = disabled
56705675

5676+
struct InviteAcceptanceEmailPolicyChangedDetails
5677+
"Changed invite accept email policy for team."
5678+
5679+
new_value InviteAcceptanceEmailPolicy
5680+
"To."
5681+
previous_value InviteAcceptanceEmailPolicy
5682+
"From."
5683+
5684+
example default
5685+
new_value = disabled
5686+
previous_value = disabled
5687+
56715688
struct MemberRequestsChangePolicyDetails
56725689
"Changed whether users can find team when not invited."
56735690

@@ -6959,6 +6976,7 @@ union EventDetails
69596976
google_sso_change_policy_details GoogleSsoChangePolicyDetails
69606977
group_user_management_change_policy_details GroupUserManagementChangePolicyDetails
69616978
integration_policy_changed_details IntegrationPolicyChangedDetails
6979+
invite_acceptance_email_policy_changed_details InviteAcceptanceEmailPolicyChangedDetails
69626980
member_requests_change_policy_details MemberRequestsChangePolicyDetails
69636981
member_send_invite_policy_changed_details MemberSendInvitePolicyChangedDetails
69646982
member_space_limits_add_exception_details MemberSpaceLimitsAddExceptionDetails
@@ -9329,6 +9347,12 @@ struct IntegrationPolicyChangedType
93299347
example default
93309348
description = "(team_policies) Changed integration policy for team"
93319349

9350+
struct InviteAcceptanceEmailPolicyChangedType
9351+
description String
9352+
9353+
example default
9354+
description = "(team_policies) Changed invite accept email policy for team"
9355+
93329356
struct MemberRequestsChangePolicyType
93339357
description String
93349358

@@ -10635,6 +10659,8 @@ union EventType
1063510659
"(team_policies) Changed who can create groups"
1063610660
integration_policy_changed IntegrationPolicyChangedType
1063710661
"(team_policies) Changed integration policy for team"
10662+
invite_acceptance_email_policy_changed InviteAcceptanceEmailPolicyChangedType
10663+
"(team_policies) Changed invite accept email policy for team"
1063810664
member_requests_change_policy MemberRequestsChangePolicyType
1063910665
"(team_policies) Changed whether users can find team when not invited"
1064010666
member_send_invite_policy_changed MemberSendInvitePolicyChangedType
@@ -11581,6 +11607,8 @@ union EventTypeArg
1158111607
"(team_policies) Changed who can create groups"
1158211608
integration_policy_changed
1158311609
"(team_policies) Changed integration policy for team"
11610+
invite_acceptance_email_policy_changed
11611+
"(team_policies) Changed invite accept email policy for team"
1158411612
member_requests_change_policy
1158511613
"(team_policies) Changed whether users can find team when not invited"
1158611614
member_send_invite_policy_changed

team_secondary_mails.stone

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct UserSecondaryEmailsArg
2424
union AddSecondaryEmailResult
2525
"Result of trying to add a secondary email to a user.
2626
'success' is the only value indicating that a secondary email was successfully added to a user.
27-
The other values explain the type of error that occurred, and include the email for which the error occured."
27+
The other values explain the type of error that occurred, and include the email for which the error occurred."
2828

2929
success SecondaryEmail
3030
"Describes a secondary email that was successfully added to a user."
@@ -72,7 +72,7 @@ struct UserSecondaryEmailsResult
7272
union UserAddResult
7373
"Result of trying to add secondary emails to a user.
7474
'success' is the only value indicating that a user was successfully retrieved for adding secondary emails.
75-
The other values explain the type of error that occurred, and include the user for which the error occured."
75+
The other values explain the type of error that occurred, and include the user for which the error occurred."
7676

7777
success UserSecondaryEmailsResult
7878
"Describes a user and the results for each attempt to add a secondary email."
@@ -147,7 +147,7 @@ struct ResendVerificationEmailArg
147147
union ResendSecondaryEmailResult
148148
"Result of trying to resend verification email to a secondary email address.
149149
'success' is the only value indicating that a verification email was successfully sent.
150-
The other values explain the type of error that occurred, and include the email for which the error occured."
150+
The other values explain the type of error that occurred, and include the email for which the error occurred."
151151

152152
success common.EmailAddress
153153
"A verification email was successfully sent to the secondary email address."
@@ -174,7 +174,7 @@ struct UserResendEmailsResult
174174
union UserResendResult
175175
"Result of trying to resend verification emails to a user.
176176
'success' is the only value indicating that a user was successfully retrieved for sending verification emails.
177-
The other values explain the type of error that occurred, and include the user for which the error occured."
177+
The other values explain the type of error that occurred, and include the user for which the error occurred."
178178

179179
success UserResendEmailsResult
180180
"Describes a user and the results for each attempt to resend verification emails."
@@ -223,7 +223,7 @@ struct DeleteSecondaryEmailsArg
223223
union DeleteSecondaryEmailResult
224224
"Result of trying to delete a secondary email address.
225225
'success' is the only value indicating that a secondary email was successfully deleted.
226-
The other values explain the type of error that occurred, and include the email for which the error occured."
226+
The other values explain the type of error that occurred, and include the email for which the error occurred."
227227

228228
success common.EmailAddress
229229
"The secondary email was successfully deleted."
@@ -253,7 +253,7 @@ struct UserDeleteEmailsResult
253253
union UserDeleteResult
254254
"Result of trying to delete a user's secondary emails.
255255
'success' is the only value indicating that a user was successfully retrieved for deleting secondary emails.
256-
The other values explain the type of error that occurred, and include the user for which the error occured."
256+
The other values explain the type of error that occurred, and include the user for which the error occurred."
257257

258258
success UserDeleteEmailsResult
259259
"Describes a user and the results for each attempt to delete a secondary email."

0 commit comments

Comments
 (0)