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

Guidance on how to name hierarchical resources #1299

Open
achew22 opened this issue Jan 29, 2024 · 0 comments
Open

Guidance on how to name hierarchical resources #1299

achew22 opened this issue Jan 29, 2024 · 0 comments

Comments

@achew22
Copy link

achew22 commented Jan 29, 2024

I've read AIP-122 through several times and I am still uncertain about how to handle a situation where you are defining resources that exists inside of another resource. To concretize it, imagine that you were doing an AIP informed resource name for memberships in Google Groups.

  1. When enumerating memberships it seems productive to name the relationship. That is to say, you might write the name for the membership as domains/example.com/groups/foo/memberships/bar@example.com. This is preferable to domains/example.com/groups/foo/users/bar@example.com, where it is ambiguous if bar@example.com is a membership, or possibly the owner of that group?

  2. Assuming point 1 is reasonable, then the question comes of, what if there are different kinds of memberships that would be allowed. Google Groups can have memberships that are both users and groups themselves. That is to say I can take the baz@example.com group and add it as a member of the foo@example.com group and anyone who is inside of either group will receive mail directed at foo@example.com. Also, for this example, please presume that it is possible to model membership information in a valid way for both groups and users (although if that is a thing that the AIP would recommend against, I would like to learn). Is the correct way to model this to treat names more as:

    1. domains/example.com/groups/foo/memberships/users/bar@example.com and domains/example.com/groups/foo/memberships/domains/example.com/groups/baz?

      Is it weird to have two delimiters that are URL indicated in a row, memberships/users? There are no examples of this, so I'm reluctant to proceed without asking.

    2. domains/example.com/groups/foo/userMemberships/bar@example.com and domains/example.com/groups/foo/groupMemberships/domains/example.com/groups/baz?

      This feels a bit odd, but may be correct due to:

      Field names may include a leading adjective if appropriate (such as string dusty_book).

      but that is for field names, not for collection names.

    3. domains/example.com/groups/foo/memberships/bar@example.com and domains/example.com/groups/foo/memberships/baz@example.com?

      Would it be better to not include the type information in the URL at all?
      In this situation how would you disambiguate between a group and a user of the same name having a memberships?

Sorry I couldn't find a better venue to ask than just in the GitHub issues for this.

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

No branches or pull requests

1 participant