blob: 6ba00756a0d569cdee9a65eef675cc522c6de499 [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001// Copyright 2020 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Copybara854996b2021-09-07 19:36:02 +00004
5// This file defines protobufs for projects and their resources.
6
7syntax = "proto3";
8
9package monorail.v3;
10
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +020011option go_package = "infra/monorailv2/api/v3/api_proto";
Copybara854996b2021-09-07 19:36:02 +000012
13import "google/protobuf/timestamp.proto";
14import "google/api/field_behavior.proto";
15import "google/api/resource.proto";
16import "api/v3/api_proto/issue_objects.proto";
17import "api/v3/api_proto/permission_objects.proto";
18
19// The top level organization of issues in Monorail.
20//
21// See monorail/doc/userguide/concepts.md#Projects-and-roles.
22// and monorail/doc/userguide/project-owners.md#why-does-monorail-have-projects
23// Next available tag: 5
24message Project {
25 option (google.api.resource) = {
26 type: "api.crbug.com/Project"
27 pattern: "projects/{project}"
28 };
29
30 // Resource name of the project.
31 string name = 1;
32 // Display name of the project.
33 string display_name = 2 [(google.api.field_behavior) = IMMUTABLE];
34 // Summary of the project, ie describing what its use and purpose.
35 string summary = 3;
36 // URL pointing to this project's logo image.
37 string thumbnail_url = 4;
38}
39
40// Potential steps along the development process that an issue can be in.
41//
42// See monorail/doc/userguide/project-owners.md#How-to-configure-statuses
43// (-- aip.dev/not-precedent: "Status" should be reserved for HTTP/gRPC codes
44// per aip.dev/216. Monorail's Status preceded the AIP standards, and is
45// used extensively throughout the system.)
46// Next available tag: 7
47message StatusDef {
48 option (google.api.resource) = {
49 type: "api.crbug.com/StatusDef"
50 pattern: "projects/{project}/statusDefs/{status_def}"
51 };
52
53 // Type of this status.
54 // Next available tag: 4
55 enum StatusDefType {
56 // Default enum value. This value is unused.
57 STATUS_DEF_TYPE_UNSPECIFIED = 0;
58 // This status means issue is open.
59 OPEN = 1;
60 // This status means issue is closed.
61 CLOSED = 2;
62 // This status means issue is merged into another.
63 MERGED = 3;
64 }
65
66 // State of this status.
67 // Next available tag: 3
68 enum StatusDefState {
69 // Default value. This value is unused.
70 STATUS_DEF_STATE_UNSPECIFIED = 0;
71 // This status is deprecated
72 DEPRECATED = 1;
73 // This status is not deprecated
74 ACTIVE = 2;
75 }
76
77 // Resource name of the status.
78 string name = 1;
79 // String value of the status.
80 string value = 2;
81 // Type of this status.
82 StatusDefType type = 3;
83 // Sorting rank of this status. If we sort issues by status
84 // this rank determines the sort order rather than status value.
85 uint32 rank = 4;
86 // Brief explanation of this status.
87 string docstring = 5;
88 // State of this status.
89 StatusDefState state = 6;
90}
91
92// Well-known labels that can be applied to issues within the project.
93//
94// See monorail/doc/userguide/concepts.md#issue-fields-and-labels.
95// Next available tag: 5
96// Labels defined in this project.
97message LabelDef {
98
99 option (google.api.resource) = {
100 type: "api.crbug.com/LabelDef"
101 pattern: "projects/{project}/labelDefs/{label_def}"
102 };
103
104 // State of this label.
105 // Next available tag: 3
106 enum LabelDefState {
107 // Default enum value. This value is unused.
108 LABEL_DEF_STATE_UNSPECIFIED = 0;
109 // This label is deprecated
110 DEPRECATED = 1;
111 // This label is not deprecated
112 ACTIVE = 2;
113 }
114
115 // Resource name of the label.
116 string name = 1;
117 // String value of the label.
118 string value = 2;
119 // Brief explanation of this label.
120 string docstring = 3;
121 // State of this label.
122 LabelDefState state = 4;
123}
124
125// Custom fields defined for the project.
126//
127// See monorail/doc/userguide/concepts.md#issue-fields-and-labels.
128// Check bugs.chromium.org/p/{project}/adminLabels to see the FieldDef IDs.
129// If your code needs to call multiple monorail instances
130// (e.g. monorail-{prod|staging|dev}) FieldDef IDs for FieldDefs
131// with the same display_name will differ between each monorail
132// instance. To see what FieldDef ID to use when calling staging
133// you must check bugs-staging.chromium.org/p/{project}/adminLabels.
134// Next available tag: 15
135message FieldDef {
136 option (google.api.resource) = {
137 type: "api.crbug.com/FieldDef"
138 pattern: "projects/{project}/fieldDefs/{field_def_id}"
139 };
140
141 // Resource name of the field.
142 string name = 1;
143 // Display name of the field.
144 string display_name = 2 [(google.api.field_behavior) = IMMUTABLE];
145 // Brief explanation of this field.
146 string docstring = 3;
147 // Type of this field.
148 // Next available tag: 7
149 enum Type {
150 // Default enum value. This value is unused.
151 TYPE_UNSPECIFIED = 0;
152 // This field can be filled only with enumerated option(s).
153 ENUM = 1;
154 // This field can be filled with integer(s).
155 INT = 2;
156 // This field can be filled with string(s).
157 STR = 3;
158 // This field can be filled with user(s).
159 USER = 4;
160 // This field can be filled with date(s).
161 DATE = 5;
162 // This field can be filled with URL(s).
163 URL = 6;
164 }
165 Type type = 4 [(google.api.field_behavior) = IMMUTABLE];
166
167 // Type of issue this field applies: ie Bug or Enhancement.
168 // Note: type is indicated by any "Type-foo" label or "Type" custom field.
169 string applicable_issue_type = 5;
170 // Administrators of this field.
171 repeated string admins = 6 [
172 (google.api.resource_reference) = { type: "api.crbug.com/User" }
173 ];
174
175 // Traits of this field, ie is required or can support multiple values.
176 // Next available tag: 6
177 enum Traits {
178 // Default enum value. This value is unused.
179 TRAITS_UNSPECIFIED = 0;
180 // This field must be filled out in issues where it's applicable.
181 REQUIRED = 1;
182 // This field defaults to hidden.
183 DEFAULT_HIDDEN = 2;
184 // This field can have multiple values.
185 MULTIVALUED = 3;
186 // This is a phase field, meaning it is repeated for each phase of an
187 // approval process. It cannot be the child of a particular approval.
188 PHASE = 4;
189 // Values of this field can only be edited in issues/templates by editors.
190 // Project owners and field admins are not subject of this restriction.
191 RESTRICTED = 5;
192 }
193 repeated Traits traits = 7;
194
195 // ApprovalDef that this field belongs to, if applicable.
196 // A field may not both have `approval_parent` set and have the PHASE trait.
197 string approval_parent = 8 [
198 (google.api.resource_reference) = { type: "api.crbug.com/ApprovalDef" },
199 (google.api.field_behavior) = IMMUTABLE
200 ];
201
202 // Settings specific to enum type fields.
203 // Next available tag: 2
204 message EnumTypeSettings {
205 // One available choice for an enum field.
206 // Next available tag: 3
207 message Choice {
208 // Value of this choice.
209 string value = 1;
210 // Brief explanation of this choice.
211 string docstring = 2;
212 }
213 repeated Choice choices = 1;
214 }
215 EnumTypeSettings enum_settings = 9;
216
217 // Settings specific to int type fields.
218 // Next available tag: 3
219 message IntTypeSettings {
220 // Minimum value that this field can have.
221 int32 min_value = 1;
222 // Maximum value that this field can have.
223 int32 max_value = 2;
224 }
225 IntTypeSettings int_settings = 10;
226
227 // Settings specific to str type fields.
228 // Next available tag: 2
229 message StrTypeSettings {
230 // Regex that this field value(s) must match.
231 string regex = 1;
232 }
233 StrTypeSettings str_settings = 11;
234
235 // Settings specific to user type fields.
236 // Next available tag: 5
237 message UserTypeSettings {
238 // Event that triggers a notification.
239 // Next available tag: 3
240 enum NotifyTriggers {
241 // Default notify trigger value. This value is unused.
242 NOTIFY_TRIGGERS_UNSPECIFIED = 0;
243 // There are no notifications.
244 NEVER = 1;
245 // Notify whenever any comment is made.
246 ANY_COMMENT = 2;
247 }
248 NotifyTriggers notify_triggers = 1;
249 // Field value(s) can only be set to users that fulfill the role
250 // requirements.
251 // Next available tag: 3
252 enum RoleRequirements {
253 // Default role requirement value. This value is unused.
254 ROLE_REQUIREMENTS_UNSPECIFIED = 0;
255 // There is no requirement.
256 NO_ROLE_REQUIREMENT = 1;
257 // Field value(s) can only be set to users who are members.
258 PROJECT_MEMBER = 2;
259 }
260 RoleRequirements role_requirements = 2;
261 // User(s) named in this field are granted this permission in the issue.
262 string grants_perm = 3;
263 // Field value(s) can only be set to users with this permission.
264 string needs_perm = 4;
265 }
266 UserTypeSettings user_settings = 12;
267
268 // Settings specific to date type fields.
269 // Next available tag: 2
270 message DateTypeSettings {
271 // Action to do when a date field value arrives.
272 // Next available tag: 4
273 enum DateAction {
274 // Default date action value. This value is unused.
275 DATE_ACTION_UNSPECIFIED = 0;
276 // No action will be taken when a date arrives.
277 NO_ACTION = 1;
278 // Notify owner only when a date arrives.
279 NOTIFY_OWNER = 2;
280 // Notify all participants when a date arrives.
281 NOTIFY_PARTICIPANTS = 3;
282 }
283 DateAction date_action = 1;
284 }
285 DateTypeSettings date_settings = 13;
286
287 // Editors of this field, only for RESTRICTED fields.
288 repeated string editors = 14 [
289 (google.api.resource_reference) = { type: "api.crbug.com/User" }
290 ];
291}
292
293// A high level definition of the part of the software affected by an issue.
294//
295// See monorail/doc/userguide/project-owners.md#how-to-configure-components.
296// Check crbug.com/p/{project}/adminComponents to see the ComponenttDef IDs.
297// Next available tag: 12
298message ComponentDef {
299 option (google.api.resource) = {
300 type: "api.crbug.com/ComponentDef"
301 pattern: "projects/{project}/componentDefs/{component_def_id}"
302 };
303
304 // The current state of the component definition.
305 // Next available tag: 3
306 enum ComponentDefState {
307 // Default enum value. This value is unused.
308 COMPONENT_DEF_STATE_UNSPECIFIED = 0;
309 // This component is deprecated
310 DEPRECATED = 1;
311 // This component is not deprecated
312 ACTIVE = 2;
313 }
314
315 // Resource name of the component, aka identifier.
316 // the API will always return ComponentDef names with format:
317 // projects/{project}/componentDefs/<component_def_id>.
318 // However the API will accept ComponentDef names with formats:
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +0200319 // projects/{project}/componentDefs/<component_def_id|value>.
Copybara854996b2021-09-07 19:36:02 +0000320 string name = 1;
321 // String value of the component, ie 'Tools>Stability' or 'Blink'.
322 string value = 2;
323 // Brief explanation of this component.
324 string docstring = 3;
325 // Administrators of this component.
326 repeated string admins = 4 [
327 (google.api.resource_reference) = { type: "api.crbug.com/User" }
328 ];
329 // Auto cc'ed users of this component.
330 repeated string ccs = 5 [
331 (google.api.resource_reference) = { type: "api.crbug.com/User" }
332 ];
333 // State of this component.
334 ComponentDefState state = 6;
335 // The user that created this component.
336 string creator = 7 [
337 (google.api.resource_reference) = { type: "api.crbug.com/User" },
338 (google.api.field_behavior) = OUTPUT_ONLY
339 ];
340 // The user that last modified this component.
341 string modifier = 8 [
342 (google.api.resource_reference) = { type: "api.crbug.com/User" },
343 (google.api.field_behavior) = OUTPUT_ONLY
344 ];
345 // The time this component was created.
346 google.protobuf.Timestamp create_time = 9 [
347 (google.api.field_behavior) = OUTPUT_ONLY
348 ];
349 // The time this component was last modified.
350 google.protobuf.Timestamp modify_time = 10 [
351 (google.api.field_behavior) = OUTPUT_ONLY
352 ];
353 // Labels that auto-apply to issues in this component.
354 repeated string labels = 11;
355}
356
357// Defines approvals that issues within the project may need.
358// See monorail/doc/userguide/concepts.md#issue-approvals-and-gates and
359// monorail/doc/userguide/project-owners.md#How-to-configure-approvals
360// Check bugs.chromium.org/p/{project}/adminLabels to see the ApprovalDef IDs.
361// If your code needs to call multiple monorail instances
362// (e.g. monorail-{prod|staging|dev}) ApprovalDef IDs for ApprovalDefs
363// with the same display_name will differ between each monorail
364// instance. To see what ApprovalDef ID to use when calling staging
365// you must check bugs-staging.chromium.org/p/{project}/adminLabels.
366// Next available tag: 7
367message ApprovalDef {
368 option (google.api.resource) = {
369 type: "api.crbug.com/ApprovalDef"
370 pattern: "projects/{project}/approvalDefs/{approval_def_id}"
371 };
372
373 // Resource name of the approval.
374 string name = 1;
375 // Display name of the field.
376 string display_name = 2 [(google.api.field_behavior) = IMMUTABLE];
377 // Brief explanation of this field.
378 string docstring = 3;
379 // Information approvers need from requester.
380 // May be adjusted on the issue after creation.
381 string survey = 4;
382 // Default list of users who can approve this field.
383 // May be adjusted on the issue after creation.
384 repeated string approvers = 5 [
385 (google.api.resource_reference) = { type: "api.crbug.com/User" }
386 ];
387 // Administrators of this field.
388 repeated string admins = 6 [
389 (google.api.resource_reference) = { type: "api.crbug.com/User" }
390 ];
391}
392
393
394// Defines saved queries that belong to a project
395//
396// Next available tag: 4
397message ProjectSavedQuery {
398 option (google.api.resource) = {
399 type: "api.crbug.com/ProjectSavedQuery"
400 pattern: "projects/{project}/savedQueries/{saved_query_id}"
401 };
402
403 // Resource name of this saved query.
404 string name = 1;
405 // Display name of this saved query, ie 'open issues'.
406 string display_name = 2;
407 // Search term of this saved query.
408 string query = 3;
409}
410
411
412// Defines a template for filling issues.
413// Next available tag: 10
414message IssueTemplate {
415 option (google.api.resource) = {
416 type: "api.crbug.com/IssueTemplate"
417 pattern: "projects/{project}/templates/{template_id}"
418 };
419 // Resource name of the template.
420 string name = 1;
421 // Display name of this template.
422 string display_name = 2 [(google.api.field_behavior) = IMMUTABLE];
423 // Canonical Issue for this template.
424 Issue issue = 3;
425 // ApprovalValues to be created with the issue when using this template.
426 repeated ApprovalValue approval_values = 9;
427 // Boolean indicating subsequent issue creation must have delta in summary.
428 bool summary_must_be_edited = 4;
429 // Visibility permission of template.
430 // Next available tag: 3
431 enum TemplatePrivacy {
432 // This value is unused.
433 TEMPLATE_PRIVACY_UNSPECIFIED = 0;
434 // Owner project members may view this template.
435 MEMBERS_ONLY = 1;
436 // Anyone on the web can view this template.
437 PUBLIC = 2;
438 }
439 TemplatePrivacy template_privacy = 5;
440 // Indicator of who if anyone should be the default owner of the issue
441 // created with this template.
442 // Next available tag: 2
443 enum DefaultOwner {
444 // There is no default owner.
445 // This value is used if the default owner is omitted.
446 DEFAULT_OWNER_UNSPECIFIED = 0;
447 // The owner should default to the Issue reporter if the reporter is a
448 // member of the project.
449 PROJECT_MEMBER_REPORTER = 1;
450 }
451 DefaultOwner default_owner = 6;
452 // Boolean indicating whether issue must have a component.
453 bool component_required = 7;
454 // Names of Users who can administer this template.
455 repeated string admins = 8 [
456 (google.api.resource_reference) = { type: "api.crbug.com/User" }];
457}
458
459
460// Defines configurations of a project
461//
462// Next available tag: 11
463message ProjectConfig {
464 option (google.api.resource) = {
465 type: "api.crbug.com/ProjectConfig"
466 pattern: "projects/{project}/config"
467 };
468
469 // Resource name of the project config.
470 string name = 1;
471 // Set of label prefixes that only apply once per issue.
472 // E.g. priority, since no issue can be both Priority-High and Priority-Low.
473 repeated string exclusive_label_prefixes = 2;
474 // Default search query for this project's members.
475 string member_default_query = 3;
476 // TODO(crbug.com/monorail/7517): consider using IssuesListColumn
477 // Default sort specification for this project.
478 string default_sort = 4;
479 // Default columns for displaying issue list for this project.
480 repeated IssuesListColumn default_columns = 5;
481 // Grid view configurations.
482 // Next available tag: 3
483 message GridViewConfig {
484 // Default column dimension in grid view for this project.
485 string default_x_attr = 1;
486 // Default row dimension in grid view for this project.
487 string default_y_attr = 2;
488 }
489 GridViewConfig project_grid_config = 6;
490 // Default template used for issue entry for members of this project.
491 string member_default_template = 7 [
492 (google.api.resource_reference) = { type: "api.crbug.com/Template" }];
493 // Default template used for issue entry for non-members of this project.
494 string non_members_default_template = 8 [
495 (google.api.resource_reference) = { type: "api.crbug.com/Template" }];
496 // URL to browse project's source code revisions for any given revnum.
497 // E.g. https://crrev.com/{revnum}
498 string revision_url_format = 9;
499 // A project's custom URL for the "New issue" link, only if specified.
500 string custom_issue_entry_url = 10;
501}
502
503// Specifies info for a member of a project.
504//
505// Next available tag: 7
506message ProjectMember {
507 // Resource name of the Project Member.
508 // projects/{project}/members/{user_id}
509 string name = 1;
510 // The role the user has in the project.
511 // Next available tag: 4
512 enum ProjectRole {
513 // The user has no role in the project.
514 PROJECT_ROLE_UNSPECIFIED = 0;
515 // The user can make any changes to the project.
516 OWNER = 1;
517 // The user may participate in the project but may not edit the project.
518 COMMITTER = 2;
519 // The user starts with the same permissions as a non-member.
520 CONTRIBUTOR = 3;
521 }
522 ProjectRole role = 2;
523 // Which built-in/standard permissions the user has set.
524 repeated Permission standard_perms = 3;
525 // Custom permissions defined for the user.
526 // eg. "Google" in "Restrict-View-Google" is an example custom permission.
527 repeated string custom_perms = 4;
528 // Annotations about a user configured by project owners.
529 // Visible to anyone who can see the project's settings.
530 string notes = 5;
531 // Whether the user should show up in autocomplete.
532 // Next available tag: 3
533 enum AutocompleteVisibility {
534 // No autocomplete visibility value specified.
535 AUTOCOMPLETE_VISIBILITY_UNSPECIFIED = 0;
536 // The user should not show up in autocomplete.
537 HIDDEN = 1;
538 // The user may show up in autocomplete.
539 SHOWN = 2;
540 }
541 AutocompleteVisibility include_in_autocomplete = 6;
542}