Skip to content

Commit 1047b4a

Browse files
authored
feat(122): make path fields readOnly (#402)
The `path` field that exists on the resource cannot be modified, and should be a readOnly field.
1 parent 087eb7d commit 1047b4a

3 files changed

Lines changed: 47 additions & 6 deletions

File tree

aep/general/0122/aep.md.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ users/vhugo1802
5252

5353
{% sample '../example.proto', 'message Book' %}
5454

55+
- The `path` field for the resource **must** be annotated with `OUTPUT_ONLY`.
56+
5557
{% tab oas %}
5658

5759
{% sample '../example.oas.yaml', '$.components.schemas.book.properties.path' %}
5860

61+
- The `path` field for the resource **must** be annotated with
62+
`readOnly: true`.
63+
5964
{% endtabs %}
6065

6166
**Note:** Resource paths as described here are used within the scope of a

aep/general/example.oas.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ components:
2222
description:
2323
The server-assigned path of the resource, which is unique within
2424
the service.
25+
readOnly: true
2526
type: string
2627
price:
2728
format: int32
@@ -50,6 +51,7 @@ components:
5051
description:
5152
The server-assigned path of the resource, which is unique within
5253
the service.
54+
readOnly: true
5355
type: string
5456
required:
5557
- display_name
@@ -68,6 +70,7 @@ components:
6870
description:
6971
The server-assigned path of the resource, which is unique within
7072
the service.
73+
readOnly: true
7174
type: string
7275
type: object
7376
x-aep-resource:
@@ -86,6 +89,7 @@ components:
8689
description:
8790
The server-assigned path of the resource, which is unique within
8891
the service.
92+
readOnly: true
8993
type: string
9094
price:
9195
format: double
@@ -111,6 +115,7 @@ components:
111115
description:
112116
The server-assigned path of the resource, which is unique within
113117
the service.
118+
readOnly: true
114119
type: string
115120
type: object
116121
x-aep-resource:
@@ -129,6 +134,7 @@ components:
129134
description:
130135
The server-assigned path of the resource, which is unique within
131136
the service.
137+
readOnly: true
132138
type: string
133139
required:
134140
- name

aep/general/example.proto

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,12 @@ message Book {
326326
repeated Author author = 5;
327327

328328
// Field for path.
329-
string path = 10018;
329+
string path = 10018 [
330+
(aep.api.field_info) = {
331+
field_behavior: [FIELD_BEHAVIOR_OUTPUT_ONLY]
332+
},
333+
(google.api.field_behavior) = OUTPUT_ONLY
334+
];
330335
}
331336

332337
// A BookEdition.
@@ -348,7 +353,12 @@ message BookEdition {
348353
];
349354

350355
// Field for path.
351-
string path = 10018;
356+
string path = 10018 [
357+
(aep.api.field_info) = {
358+
field_behavior: [FIELD_BEHAVIOR_OUTPUT_ONLY]
359+
},
360+
(google.api.field_behavior) = OUTPUT_ONLY
361+
];
352362
}
353363

354364
// A Isbn.
@@ -361,7 +371,12 @@ message Isbn {
361371
};
362372

363373
// Field for path.
364-
string path = 10018;
374+
string path = 10018 [
375+
(aep.api.field_info) = {
376+
field_behavior: [FIELD_BEHAVIOR_OUTPUT_ONLY]
377+
},
378+
(google.api.field_behavior) = OUTPUT_ONLY
379+
];
365380
}
366381

367382
// A Item.
@@ -393,7 +408,12 @@ message Item {
393408
];
394409

395410
// Field for path.
396-
string path = 10018;
411+
string path = 10018 [
412+
(aep.api.field_info) = {
413+
field_behavior: [FIELD_BEHAVIOR_OUTPUT_ONLY]
414+
},
415+
(google.api.field_behavior) = OUTPUT_ONLY
416+
];
397417
}
398418

399419
// A Publisher.
@@ -409,7 +429,12 @@ message Publisher {
409429
string description = 1;
410430

411431
// Field for path.
412-
string path = 10018;
432+
string path = 10018 [
433+
(aep.api.field_info) = {
434+
field_behavior: [FIELD_BEHAVIOR_OUTPUT_ONLY]
435+
},
436+
(google.api.field_behavior) = OUTPUT_ONLY
437+
];
413438
}
414439

415440
// A Store.
@@ -433,7 +458,12 @@ message Store {
433458
string description = 2;
434459

435460
// Field for path.
436-
string path = 10018;
461+
string path = 10018 [
462+
(aep.api.field_info) = {
463+
field_behavior: [FIELD_BEHAVIOR_OUTPUT_ONLY]
464+
},
465+
(google.api.field_behavior) = OUTPUT_ONLY
466+
];
437467
}
438468

439469
// A Create request for a book resource.

0 commit comments

Comments
 (0)