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

feat(AIP-121): Disallow recursive hierarchies #1220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

noahdietz
Copy link
Collaborator

Simply disallow recursive resource hierarchies.

@noahdietz noahdietz requested a review from a team as a code owner September 18, 2023 22:46
@noahdietz noahdietz requested review from jskeet, bgrant0607 and andrei-scripniciuc and removed request for bgrant0607 September 18, 2023 22:46
Copy link
Contributor

@jskeet jskeet left a comment

Choose a reason for hiding this comment

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

Should we be a little more descriptive about what we're prohibiting here?

It's worth considering the Firestore API, where there are alternating document/collection elements, e.g. projects/x/databases/y/documents/people/jon/computers/panther... the resource isn't annotated, but has a comment explaining that the pattern is projects/{project_id}/databases/{database_id}/documents/{document_path}. Is that okay because it's effectively internal, rather than expressed in the proto itself? Would we want to prohibit it if we could go back in time?

@noahdietz
Copy link
Collaborator Author

Should we be a little more descriptive about what we're prohibiting here?

@jskeet yeah I was struggling to find a balance in using concrete examples while also avoiding repeating the AIP-122/AIP-123 guidance. This AIP being more conceptual makes me want to avoid getting into the implementation, but some more detail is warranted...I'll fiddle with it.

where there are alternating document/collection elements...projects/{project_id}/databases/{database_id}/documents/{document_path}. Is that okay because it's effectively internal, rather than expressed in the proto itself?

This is a tricky one. So if the document_path section is defined basically as ** i.e. "any amount of slash-separated segments", and if those segments alternate as "collection" "resource" as you mention, then one could say that firestore has a recursive resource hierarchy, even though it isn't formalized.

Would we want to prohibit it if we could go back in time?

Yes I think so. This might come out weird, but I always saw firestore's "document path" as basically dot-notation for navigating the blob, where the top-level of the blob i.e. .../databases/{database}/documents/{document} (but without the following /**) represented the actual resource. I don't think this is how resource name hierarchies are meant to be used though?

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.

None yet

2 participants