-
Notifications
You must be signed in to change notification settings - Fork 27
Adopt AEP-202: Fields #155
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
20c5dce
671cf6e
29efd03
64bd912
bbdfbd1
7d015e6
9e8378f
d7855ab
511125d
302d83a
4aa9c22
fafbd0d
5f38c6f
1eaa4e1
bd557c0
20dd825
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Fields | ||
|
|
||
| The [`buf.validate.field`][protovalidate] type, through its accompanying | ||
| extension `buf.validate.field`, enriches a field's schema beyond the basic | ||
| name and type information. | ||
|
rambleraptor marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Guidance | ||
|
|
||
| Decorating a field with `buf.validate.field` is only necessary when a field | ||
|
rambleraptor marked this conversation as resolved.
Outdated
|
||
| consistently follows a set pattern. | ||
|
rambleraptor marked this conversation as resolved.
Outdated
|
||
|
|
||
| #### Format Compatibility | ||
|
rambleraptor marked this conversation as resolved.
Outdated
|
||
|
|
||
| Adding a format specifier to an existing, unspecified field **is not** backwards | ||
|
rambleraptor marked this conversation as resolved.
Outdated
|
||
| compatible, *unless* the field in question has always conformed to the format | ||
| being specified. | ||
|
rambleraptor marked this conversation as resolved.
Outdated
|
||
|
|
||
| Changing an existing format specifier to a different one in all cases **is not** | ||
|
rambleraptor marked this conversation as resolved.
Outdated
|
||
| backwards compatible. | ||
|
|
||
| ## Rationale | ||
|
|
||
| #### Why add a format specifier? | ||
|
rambleraptor marked this conversation as resolved.
|
||
|
|
||
| The format of a primitive-typed field can be critical to its usability. Some | ||
| programming languages may convey a specific type format as a standalone type, | ||
| as Java does with [UUID][java uuid]. Most have specific structural requirements | ||
| that are validated by the service, so conveying the format to the user ahead of | ||
| time is critical to their experience. | ||
|
|
||
| #### Why discourage primitive equality comparisons? | ||
|
rambleraptor marked this conversation as resolved.
Outdated
|
||
|
|
||
| The text representations of the supported formats have many nuances and | ||
| transforming the value into a canonical representation is non-trivial. As such, | ||
| aligning implementations between each consumer and each service without any | ||
| issue is infeasiable. | ||
|
|
||
| #### Why document value normalizations? | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, what guidance does this refer to?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The above guidance should satisfy this rationale.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which guidance, specifically? As in, which line of the file says to document value normalization? The word "normalization" doesn't appear before line 37.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I wasn't being precise enough about that. It was implicit. I've added some information in the beginning explaining how validators are useful for field normalization and why that process occurs. Let me know if it isn't precise enough. |
||
|
|
||
| While primitive comparison is not recommended for any of the supported formats, | ||
| uniform normalization of values is important to set consumer expectations, and | ||
| create a user-friendly surface. | ||
|
|
||
| #### Why require an RFC or AEP for new formats? | ||
|
rambleraptor marked this conversation as resolved.
Outdated
|
||
|
|
||
| Those formats which are sufficiently standardized to merit an RFC or AEP are | ||
| stable enough and widely enough known to be incorporated as a supported value | ||
| and see usage in Google APIs. Requiring such extra guidance means that governing | ||
| the format specification is not the responsibility of the `buf.validate.field` | ||
| enumeration itself. | ||
|
|
||
| [protovalidate]: https://github.com/bufbuild/protovalidate/tree/main/proto/protovalidate | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| id: 202 | ||
| state: reviewing | ||
| slug: fields | ||
| created: 2023-01-22 | ||
| placement: | ||
| category: protobuf |
Uh oh!
There was an error while loading. Please reload this page.