Skip to content

Spec Update 06/23/2021 #44

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

Merged
merged 1 commit into from
Jun 23, 2021
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
2 changes: 1 addition & 1 deletion files.stone
Original file line number Diff line number Diff line change
Expand Up @@ -2590,7 +2590,7 @@ route get_temporary_upload_link(GetTemporaryUploadLinkArg, GetTemporaryUploadLin
of the uploaded data in JSON format.


Example succesful temporary upload link consumption response:
Example successful temporary upload link consumption response:

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

Expand Down
188 changes: 188 additions & 0 deletions release_note_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
import os
import re
from enum import Enum
from datetime import date
from collections import defaultdict
from sys import argv
from typing import List, Optional, NamedTuple, Tuple
from unidiff import PatchSet

class DataType(str, Enum):
ROUTE = "route"
STRUCT = "struct"
UNION = "union"

NsChange = NamedTuple('NsChange', [
('file_name', str),
('added_routes', List[str]),
('added_structs', List[str]),
('added_unions', List[str]),
('deprecated_routes', List[str]),
('removed_routes', List[str]),
('removed_structs', List[str]),
('removed_unions', List[str]),
('updated_datatypes', Optional[List[Tuple[str, DataType]]]),
])

ChangeLog = NamedTuple('ChangeLog', [
('ns_changes', List[NsChange]),
('added_nses', List[str]),
('removed_nses', List[str]),
])


def parse_datatype_info(line):
# type: (str) -> Optional[Tuple[DataType, str]]
route = re.match(r"^route (.+)\(", line)
struct = re.match(r"^struct (.+)$", line)
union = re.match(r"^union (.+)$", line)
match = struct or union or route
if not match:
return None
datatype = DataType.ROUTE
if struct:
datatype = DataType.STRUCT
if union:
datatype = DataType.UNION
return datatype, match.group(1)


def parse_change_log(change_log_diff):
# type: (str) -> ChangeLog
ns_changes = []
added_nses = []
removed_nses = []

patch = PatchSet(change_log_diff)
for patch_file in patch:
path_parts = patch_file.path.split('.')
if len(path_parts) != 2:
continue
ns_file_name, ext = path_parts
if ext != "stone":
continue

if patch_file.is_added_file:
added_nses.append(ns_file_name)
continue

if patch_file.is_removed_file:
removed_nses.append(ns_file_name)
continue

added_routes = []
added_structs = []
added_unions = []
deprecated_routes = []
removed_routes = []
removed_structs = []
removed_unions = []
updated_datatypes = []

route_map = defaultdict(int)

# Pass for checking for creation/deletion of datatypes
for hunk in patch_file:
for line in hunk:
datatype_info = parse_datatype_info(line.value)
if datatype_info is None:
continue
datatype, datatype_name = datatype_info

if datatype == DataType.ROUTE:
if line.is_added:
route_map[datatype_name] += 1
if line.is_removed:
route_map[datatype_name] -= 1

if datatype == DataType.STRUCT:
if line.is_added:
added_structs.append(datatype_name)
if line.is_removed:
removed_structs.append(datatype_name)

if datatype == DataType.UNION:
if line.is_added:
added_unions.append(datatype_name)
if line.is_removed:
removed_unions.append(datatype_name)


datatype, datatype_name = None, None
seen_datatypes = set()

# Pass to check for updated datatypes
for line in hunk:
datatype_info = parse_datatype_info(line.value)
if datatype_info and not line.is_removed:
if line.is_added:
datatype, datatype_name = None, None
else:
datatype, datatype_name = datatype_info
if not datatype_info and datatype and datatype_name:
if line.is_removed or line.is_added and datatype_name not in seen_datatypes:
updated_datatypes.append((datatype, datatype_name))
seen_datatypes.add(datatype_name)

for route, ref_count in route_map.iteritems():
if ref_count > 0:
added_routes.append(route)
if ref_count < 0:
removed_routes.append(route)

ns_change = NsChange(
ns_file_name,
added_routes,
added_structs,
added_unions,
deprecated_routes,
removed_routes,
removed_structs,
removed_unions,
updated_datatypes,
)
ns_changes.append(ns_change)

change_log = ChangeLog(ns_changes, added_nses, removed_nses)
return change_log


def main():
stream = os.popen('git diff')
diff = stream.read()
change_log = parse_change_log(diff)
print "Spec Update {} (#<TODO>)".format(date.today().strftime("%m/%d/%Y"))
print
print "Change Notes:"
for ns_change in change_log.ns_changes:
print
print "{} Namespace".format(ns_change.file_name)
if ns_change.added_routes:
print "- Add {} routes".format(", ".join(ns_change.added_routes))
if ns_change.added_structs:
print "- Add {} structs".format(", ".join(ns_change.added_structs))
if ns_change.added_unions:
print "- Add {} unions".format(", ".join(ns_change.added_unions))
if ns_change.removed_routes:
print "- Remove {} routes".format(", ".join(ns_change.removed_routes))
if ns_change.removed_structs:
print "- Remove {} structs".format(", ".join(ns_change.removed_structs))
if ns_change.removed_unions:
print "- Remove {} unions".format(", ".join(ns_change.removed_unions))
if ns_change.updated_datatypes:
for datatype, datatype_name in ns_change.updated_datatypes:
print "- Update {} {} to include/remove/deprecate <TODO>".format(datatype_name, datatype)
if change_log.added_nses:
print
for ns in change_log.added_nses:
print("Add {} namespace".format(ns))

if change_log.removed_nses:
print
for ns in change_log.removed_nses:
print("Add {} namespace".format(ns))


if __name__ == "__main__":
main()

2 changes: 1 addition & 1 deletion sharing_files.stone
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ struct AddFileMemberArgs

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

custom_message String?
Expand Down
2 changes: 1 addition & 1 deletion team_legal_holds.stone
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct LegalHoldPolicy
activation_time common.DropboxTimestamp?
"The time at which the legal hold was activated."
members MembersInfo
"Team members IDs and number of permanetly deleted members under hold."
"Team members IDs and number of permanently deleted members under hold."
status LegalHoldStatus
"The current state of the hold."
start_date common.DropboxTimestamp
Expand Down
28 changes: 28 additions & 0 deletions team_log_generated.stone
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,11 @@ union IntegrationPolicy
disabled
enabled

union InviteAcceptanceEmailPolicy
"Policy for deciding whether team admins receive email when an invitation to join the team is accepted"
disabled
enabled

union LabelType
"Label type"
personal_information
Expand Down Expand Up @@ -5668,6 +5673,18 @@ struct IntegrationPolicyChangedDetails
new_value = disabled
previous_value = disabled

struct InviteAcceptanceEmailPolicyChangedDetails
"Changed invite accept email policy for team."

new_value InviteAcceptanceEmailPolicy
"To."
previous_value InviteAcceptanceEmailPolicy
"From."

example default
new_value = disabled
previous_value = disabled

struct MemberRequestsChangePolicyDetails
"Changed whether users can find team when not invited."

Expand Down Expand Up @@ -6959,6 +6976,7 @@ union EventDetails
google_sso_change_policy_details GoogleSsoChangePolicyDetails
group_user_management_change_policy_details GroupUserManagementChangePolicyDetails
integration_policy_changed_details IntegrationPolicyChangedDetails
invite_acceptance_email_policy_changed_details InviteAcceptanceEmailPolicyChangedDetails
member_requests_change_policy_details MemberRequestsChangePolicyDetails
member_send_invite_policy_changed_details MemberSendInvitePolicyChangedDetails
member_space_limits_add_exception_details MemberSpaceLimitsAddExceptionDetails
Expand Down Expand Up @@ -9329,6 +9347,12 @@ struct IntegrationPolicyChangedType
example default
description = "(team_policies) Changed integration policy for team"

struct InviteAcceptanceEmailPolicyChangedType
description String

example default
description = "(team_policies) Changed invite accept email policy for team"

struct MemberRequestsChangePolicyType
description String

Expand Down Expand Up @@ -10635,6 +10659,8 @@ union EventType
"(team_policies) Changed who can create groups"
integration_policy_changed IntegrationPolicyChangedType
"(team_policies) Changed integration policy for team"
invite_acceptance_email_policy_changed InviteAcceptanceEmailPolicyChangedType
"(team_policies) Changed invite accept email policy for team"
member_requests_change_policy MemberRequestsChangePolicyType
"(team_policies) Changed whether users can find team when not invited"
member_send_invite_policy_changed MemberSendInvitePolicyChangedType
Expand Down Expand Up @@ -11581,6 +11607,8 @@ union EventTypeArg
"(team_policies) Changed who can create groups"
integration_policy_changed
"(team_policies) Changed integration policy for team"
invite_acceptance_email_policy_changed
"(team_policies) Changed invite accept email policy for team"
member_requests_change_policy
"(team_policies) Changed whether users can find team when not invited"
member_send_invite_policy_changed
Expand Down
12 changes: 6 additions & 6 deletions team_secondary_mails.stone
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct UserSecondaryEmailsArg
union AddSecondaryEmailResult
"Result of trying to add a secondary email to a user.
'success' is the only value indicating that a secondary email was successfully added to a user.
The other values explain the type of error that occurred, and include the email for which the error occured."
The other values explain the type of error that occurred, and include the email for which the error occurred."

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

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

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

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

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

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