-
Notifications
You must be signed in to change notification settings - Fork 529
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
Add guidance to avoid overly generic resource names. #1288
base: master
Are you sure you want to change the base?
Conversation
These often cause confusion down the line as the API introduces more concepts.
Note: the date will need to be updated if this is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a quick blurb in a Rationale
sub-section? Something like ### Overly generic type names
Added rationale as suggested. |
### Overly Generic Type Names | ||
|
||
Overly generic types like `Metadata` or `Resource` will cause confusion as the | ||
API introduces more concepts. Unless the resource represents a | ||
[singleton][aip-156] containing API-level settings, a more specific name should | ||
be used. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In light of the recent guidance to avoid generic resource names,
I recommend providing developers with specific naming conventions for common patterns. For instance, patterns where information is passed as a 'bag' of data, often seen in APIs like:
- https://stripe.com/docs/api/metadata
- Pass through transient data to webhooks on registration ory/kratos#3102
These patterns typically involve attaching transient(depending of the workflow) data to a resource or tagging for message-passing and webhook consumption. I've encountered this frequently and concur that a standardized terminology would be beneficial. Specifically, distinguishing between two levels of metadata can be crucial:
- System Metadata: This level is intended for developers and controls system-level workflows. Only programmers should attach data to these objects based on Internal concerns to the service that defined.
- User-Level Metadata: Allows external clients to append information, enabling control over the flow not just internally but also for client-side processes.
By adopting distinct terms for these levels, we can reduce confusion and enhance the clarity and functionality of our API designs.
I would love to hear your thoughts about the topic and how Google thinks about it.
These often cause confusion down the line as the API introduces more concepts.