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

[Breaking] Reorg the user-group apis with a explicit google group spec field. #33

Merged
merged 11 commits into from
Jun 18, 2024

Conversation

anekkanti
Copy link
Member

@anekkanti anekkanti commented May 29, 2024

This change is backward incompatible. But we control who and how its being used. Should be safe to merge.

Comment on lines 84 to 90
// The type of the group.
// Currently, the only supported type is 'google-group'.
// The type is immutable. Once set during creation, it cannot be changed.
string type = 3;
// The specification of the google group.
// This field is required when the group type is 'google-group'.
GoogleGroupSpec google_group = 4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't the presence of google_group be enough to not need type? Would you consider a oneof? Same for the filter on the request.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will sight the discussion here:
#23 (comment)
We decided not to use one-off but rely on presence or absence of fields instead of a explicit type.
Let me remove the type field.

Comment on lines 362 to 367
// Filter groups by the group type - optional.
// Possible values: google-group
string group_type = 5;
// Filter groups by the google group email - optional.
// Only applicable when group_type filter is set to google group-type.
string google_group_email_address = 6;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do the same thing here as you did in the spec? Specifically can you have a GoogleGroupFilter that can contain filterable fields and even just its empty presence is like group_type? My concern is that you're going to add a new top-level field for every field inside every spec type, and they only work if they are set as the same time as something else which is confusing.

Copy link
Member Author

@anekkanti anekkanti Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just updated and removed the type field.

and even just its empty presence is like group_type

Proto3 does not distinguish between empty and unset scalars.
protocolbuffers/protobuf#1606 (comment)
I don't think we can implement a type filter with just a googleGroupFilter.

Copy link
Member

@cretz cretz Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proto3 does not distinguish between empty and unset scalars.

That is unrelated to my concern now about top-level fields. Are you going to add a new top-level field for every field you want to filter on each group type? My suggestion is just making a a child object for all google group filter fields (and another for the next one) instead of moving them all top level. Same reason you have UserGroupSpec.google_group.email_address instead of UserGroupSpec.google_group_email_address, you should have GetUserGroupsRequest.google_group.email_address instead of GetUserGroupsRequest.google_group_email_address.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, makes sense. Added a child object as suggested.

@@ -349,6 +349,11 @@ message DeleteApiKeyResponse {
temporal.api.cloud.operation.v1.AsyncOperation async_operation = 1;
}

message GoogleGroupGetUserGroupsFilter {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the biggest fan of this name (I'd just have made a nested GoogleGroupFilter in GetUserGroupsRequest) but not that big of a deal

// Filter groups by the display name - optional.
string display_name = 4;

message GoogleGroupFilter {
Copy link
Member

@cretz cretz Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think it's best to put all nested messages at the bottom of the parent, though some proto authors put them at the top, but I don't think it's very common to intersperse between fields. (this is pedantic and doesn't affect my approval of the PR)

@anekkanti anekkanti merged commit 508379b into main Jun 18, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants