xref: /aosp_15_r20/external/googleapis/google/api/field_info.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.api;
18
19import "google/protobuf/descriptor.proto";
20
21option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
22option java_multiple_files = true;
23option java_outer_classname = "FieldInfoProto";
24option java_package = "com.google.api";
25option objc_class_prefix = "GAPI";
26
27extend 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.api.FieldInfo field_info = 291403980;
39}
40
41// Rich semantic information of an API field beyond basic typing.
42message FieldInfo {
43  // The standard format of a field value. The supported formats are all backed
44  // by either an RFC defined by the IETF or a Google-defined AIP.
45  enum Format {
46    // Default, unspecified value.
47    FORMAT_UNSPECIFIED = 0;
48
49    // Universally Unique Identifier, version 4, value as defined by
50    // https://datatracker.ietf.org/doc/html/rfc4122. The value may be
51    // normalized to entirely lowercase letters. For example, the value
52    // `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
53    // `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
54    UUID4 = 1;
55
56    // Internet Protocol v4 value as defined by [RFC
57    // 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
58    // condensed, with leading zeros in each octet stripped. For example,
59    // `001.022.233.040` would be condensed to `1.22.233.40`.
60    IPV4 = 2;
61
62    // Internet Protocol v6 value as defined by [RFC
63    // 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
64    // normalized to entirely lowercase letters with zeros compressed, following
65    // [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
66    // the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
67    IPV6 = 3;
68
69    // An IP address in either v4 or v6 format as described by the individual
70    // values defined herein. See the comments on the IPV4 and IPV6 types for
71    // allowed normalizations of each.
72    IPV4_OR_IPV6 = 4;
73  }
74
75  // The standard format of a field value. This does not explicitly configure
76  // any API consumer, just documents the API's format for the field it is
77  // applied to.
78  Format format = 1;
79}
80