Skip to content

Commit 154d8dc

Browse files
feat(AIP-140): allow url field name in specific cases (#1551)
1 parent a851e01 commit 154d8dc

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

aip/general/0140.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,28 @@ this case, services **may** use a `string`.
137137

138138
### URIs
139139

140-
Field names representing URLs or URIs **should** always use `uri` rather than
141-
`url`. This is because while all URLs are URIs, not all URIs are URLs. Field
142-
names **may** use a prefix in front of `uri` as appropriate.
140+
Field names representing arbitrary URIs **should** use `uri`. In particular,
141+
note that URLs are URIs but not all URIs are URLs.
142+
143+
Field names **may** use a prefix in front of `uri` as appropriate.
144+
145+
Field names that can only represent a URL **should** use `url`.
146+
147+
```proto
148+
message Book {
149+
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
150+
151+
// A URL pointing to an image of the book.
152+
string image_url = 2;
153+
154+
// A URI identifying the book.
155+
// This could be an ISBN or a URL.
156+
string uri = 3;
157+
}
158+
```
159+
160+
**Note:** APIs that have previously used `uri` for URL fields may continue to
161+
do so to avoid unnecessary API changes and to preserve local consistency.
143162

144163
### Reserved words
145164

0 commit comments

Comments
 (0)