xref: /aosp_15_r20/external/googleapis/google/cloud/contentwarehouse/v1/document_schema.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.cloud.contentwarehouse.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/protobuf/timestamp.proto";
22
23option csharp_namespace = "Google.Cloud.ContentWarehouse.V1";
24option go_package = "cloud.google.com/go/contentwarehouse/apiv1/contentwarehousepb;contentwarehousepb";
25option java_multiple_files = true;
26option java_outer_classname = "DocumentSchemaProto";
27option java_package = "com.google.cloud.contentwarehouse.v1";
28option php_namespace = "Google\\Cloud\\ContentWarehouse\\V1";
29option ruby_package = "Google::Cloud::ContentWarehouse::V1";
30
31// A document schema used to define document structure.
32message DocumentSchema {
33  option (google.api.resource) = {
34    type: "contentwarehouse.googleapis.com/DocumentSchema"
35    pattern: "projects/{project}/locations/{location}/documentSchemas/{document_schema}"
36  };
37
38  // The resource name of the document schema.
39  // Format:
40  // projects/{project_number}/locations/{location}/documentSchemas/{document_schema_id}.
41  //
42  // The name is ignored when creating a document schema.
43  string name = 1;
44
45  // Required. Name of the schema given by the user. Must be unique per project.
46  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
47
48  // Document details.
49  repeated PropertyDefinition property_definitions = 3;
50
51  // Document Type, true refers the document is a folder, otherwise it is
52  // a typical document.
53  bool document_is_folder = 4;
54
55  // Output only. The time when the document schema is last updated.
56  google.protobuf.Timestamp update_time = 5
57      [(google.api.field_behavior) = OUTPUT_ONLY];
58
59  // Output only. The time when the document schema is created.
60  google.protobuf.Timestamp create_time = 6
61      [(google.api.field_behavior) = OUTPUT_ONLY];
62
63  // Schema description.
64  string description = 7;
65}
66
67// Defines the metadata for a schema property.
68message PropertyDefinition {
69  // Stores the retrieval importance.
70  enum RetrievalImportance {
71    // No importance specified. Default medium importance.
72    RETRIEVAL_IMPORTANCE_UNSPECIFIED = 0;
73
74    // Highest importance.
75    HIGHEST = 1;
76
77    // Higher importance.
78    HIGHER = 2;
79
80    // High importance.
81    HIGH = 3;
82
83    // Medium importance.
84    MEDIUM = 4;
85
86    // Low importance (negative).
87    LOW = 5;
88
89    // Lowest importance (negative).
90    LOWEST = 6;
91  }
92
93  // The schema source information.
94  message SchemaSource {
95    // The schema name in the source.
96    string name = 1;
97
98    // The Doc AI processor type name.
99    string processor_type = 2;
100  }
101
102  // Required. The name of the metadata property.
103  // Must be unique within a document schema and is case insensitive.
104  // Names must be non-blank, start with a letter, and can contain alphanumeric
105  // characters and: /, :, -, _, and .
106  string name = 1 [(google.api.field_behavior) = REQUIRED];
107
108  // The display-name for the property, used for front-end.
109  string display_name = 12;
110
111  // Whether the property can have multiple values.
112  bool is_repeatable = 2;
113
114  // Whether the property can be filtered. If this is a sub-property, all the
115  // parent properties must be marked filterable.
116  bool is_filterable = 3;
117
118  // Indicates that the property should be included in a global search.
119  bool is_searchable = 4;
120
121  // Whether the property is user supplied metadata.
122  // This out-of-the box placeholder setting can be used to tag derived
123  // properties. Its value and interpretation logic should be implemented by API
124  // user.
125  bool is_metadata = 5;
126
127  // Whether the property is mandatory.
128  // Default is 'false', i.e. populating property value can be skipped.
129  // If 'true' then user must populate the value for this property.
130  bool is_required = 14;
131
132  // The retrieval importance of the property during search.
133  RetrievalImportance retrieval_importance = 18;
134
135  // Type of the property.
136  oneof value_type_options {
137    // Integer property.
138    IntegerTypeOptions integer_type_options = 7;
139
140    // Float property.
141    FloatTypeOptions float_type_options = 8;
142
143    // Text/string property.
144    TextTypeOptions text_type_options = 9;
145
146    // Nested structured data property.
147    PropertyTypeOptions property_type_options = 10;
148
149    // Enum/categorical property.
150    EnumTypeOptions enum_type_options = 11;
151
152    // Date time property.
153    // It is not supported by CMEK compliant deployment.
154    DateTimeTypeOptions date_time_type_options = 13;
155
156    // Map property.
157    MapTypeOptions map_type_options = 15;
158
159    // Timestamp property.
160    // It is not supported by CMEK compliant deployment.
161    TimestampTypeOptions timestamp_type_options = 16;
162  }
163
164  // The mapping information between this property to another schema source.
165  repeated SchemaSource schema_sources = 19;
166}
167
168// Configurations for an integer property.
169message IntegerTypeOptions {}
170
171// Configurations for a float property.
172message FloatTypeOptions {}
173
174// Configurations for a text property.
175message TextTypeOptions {}
176
177// Configurations for a date time property.
178message DateTimeTypeOptions {}
179
180// Configurations for a Map property.
181message MapTypeOptions {}
182
183// Configurations for a timestamp property.
184message TimestampTypeOptions {}
185
186// Configurations for a nested structured data property.
187message PropertyTypeOptions {
188  // Required. List of property definitions.
189  repeated PropertyDefinition property_definitions = 1
190      [(google.api.field_behavior) = REQUIRED];
191}
192
193// Configurations for an enum/categorical property.
194message EnumTypeOptions {
195  // Required. List of possible enum values.
196  repeated string possible_values = 1 [(google.api.field_behavior) = REQUIRED];
197
198  // Make sure the Enum property value provided in the document is in the
199  // possile value list during document creation. The validation check runs by
200  // default.
201  bool validation_check_disabled = 2;
202}
203