| 1 |
// Copyright 2026 Google LLC |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
syntax = "proto3"; |
| 16 |
|
| 17 |
package google.api; |
| 18 |
|
| 19 |
import "google/protobuf/descriptor.proto"; |
| 20 |
|
| 21 |
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; |
| 22 |
option java_multiple_files = true; |
| 23 |
option java_outer_classname = "FieldInfoProto"; |
| 24 |
option java_package = "com.google.api"; |
| 25 |
option objc_class_prefix = "GAPI"; |
| 26 |
|
| 27 |
extend google.protobuf.FieldOptions { |
| 28 |
// Rich semantic descriptor of an API field beyond the basic typing. |
| 29 |
// |
| 30 |
// Examples: |
| 31 |
// |
| 32 |
// string request_id = 1 [(google.api.field_info).format = UUID4]; |
| 33 |
// string old_ip_address = 2 [(google.api.field_info).format = IPV4]; |
| 34 |
// string new_ip_address = 3 [(google.api.field_info).format = IPV6]; |
| 35 |
// string actual_ip_address = 4 [ |
| 36 |
// (google.api.field_info).format = IPV4_OR_IPV6 |
| 37 |
// ]; |
| 38 |
// google.protobuf.Any generic_field = 5 [ |
| 39 |
// (google.api.field_info).referenced_types = {type_name: "ActualType"}, |
| 40 |
// (google.api.field_info).referenced_types = {type_name: "OtherType"}, |
| 41 |
// ]; |
| 42 |
// google.protobuf.Any generic_user_input = 5 [ |
| 43 |
// (google.api.field_info).referenced_types = {type_name: "*"}, |
| 44 |
// ]; |
| 45 |
google.api.FieldInfo field_info = 291403980; |
| 46 |
} |
| 47 |
|
| 48 |
// Rich semantic information of an API field beyond basic typing. |
| 49 |
message FieldInfo { |
| 50 |
// The standard format of a field value. The supported formats are all backed |
| 51 |
// by either an RFC defined by the IETF or a Google-defined AIP. |
| 52 |
enum Format { |
| 53 |
// Default, unspecified value. |
| 54 |
FORMAT_UNSPECIFIED = 0; |
| 55 |
|
| 56 |
// Universally Unique Identifier, version 4, value as defined by |
| 57 |
// https://datatracker.ietf.org/doc/html/rfc4122. The value may be |
| 58 |
// normalized to entirely lowercase letters. For example, the value |
| 59 |
// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to |
| 60 |
// `f47ac10b-58cc-0372-8567-0e02b2c3d479`. |
| 61 |
UUID4 = 1; |
| 62 |
|
| 63 |
// Internet Protocol v4 value as defined by [RFC |
| 64 |
// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be |
| 65 |
// condensed, with leading zeros in each octet stripped. For example, |
| 66 |
// `001.022.233.040` would be condensed to `1.22.233.40`. |
| 67 |
IPV4 = 2; |
| 68 |
|
| 69 |
// Internet Protocol v6 value as defined by [RFC |
| 70 |
// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be |
| 71 |
// normalized to entirely lowercase letters with zeros compressed, following |
| 72 |
// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example, |
| 73 |
// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`. |
| 74 |
IPV6 = 3; |
| 75 |
|
| 76 |
// An IP address in either v4 or v6 format as described by the individual |
| 77 |
// values defined herein. See the comments on the IPV4 and IPV6 types for |
| 78 |
// allowed normalizations of each. |
| 79 |
IPV4_OR_IPV6 = 4; |
| 80 |
} |
| 81 |
|
| 82 |
// The standard format of a field value. This does not explicitly configure |
| 83 |
// any API consumer, just documents the API's format for the field it is |
| 84 |
// applied to. |
| 85 |
Format format = 1; |
| 86 |
|
| 87 |
// The type(s) that the annotated, generic field may represent. |
| 88 |
// |
| 89 |
// Currently, this must only be used on fields of type `google.protobuf.Any`. |
| 90 |
// Supporting other generic types may be considered in the future. |
| 91 |
repeated TypeReference referenced_types = 2; |
| 92 |
} |
| 93 |
|
| 94 |
// A reference to a message type, for use in [FieldInfo][google.api.FieldInfo]. |
| 95 |
message TypeReference { |
| 96 |
// The name of the type that the annotated, generic field may represent. |
| 97 |
// If the type is in the same protobuf package, the value can be the simple |
| 98 |
// message name e.g., `"MyMessage"`. Otherwise, the value must be the |
| 99 |
// fully-qualified message name e.g., `"google.library.v1.Book"`. |
| 100 |
// |
| 101 |
// If the type(s) are unknown to the service (e.g. the field accepts generic |
| 102 |
// user input), use the wildcard `"*"` to denote this behavior. |
| 103 |
// |
| 104 |
// See [AIP-202](https://google.aip.dev/202#type-references) for more details. |
| 105 |
string type_name = 1; |
| 106 |
} |