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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<title>Protocol Buffers – FieldMask</title>
|
| 7 |
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap">
|
| 8 |
+
<style>
|
| 9 |
+
:root {
|
| 10 |
+
--bg: #0d1117;
|
| 11 |
+
--surface: #161b22;
|
| 12 |
+
--border: #30363d;
|
| 13 |
+
--text: #c9d1d9;
|
| 14 |
+
--text-muted: #8b949e;
|
| 15 |
+
--accent: #58a6ff;
|
| 16 |
+
--code-bg: #0d1117;
|
| 17 |
+
--code-border: #30363d;
|
| 18 |
+
--mono: 'JetBrains Mono', monospace;
|
| 19 |
+
}
|
| 20 |
+
* {
|
| 21 |
+
box-sizing: border-box;
|
| 22 |
+
}
|
| 23 |
+
body {
|
| 24 |
+
margin: 0;
|
| 25 |
+
font-family: 'Inter', sans-serif;
|
| 26 |
+
background: var(--bg);
|
| 27 |
+
color: var(--text);
|
| 28 |
+
line-height: 1.7;
|
| 29 |
+
scroll-behavior: smooth;
|
| 30 |
+
}
|
| 31 |
+
header {
|
| 32 |
+
padding: 2rem 1rem;
|
| 33 |
+
border-bottom: 1px solid var(--border);
|
| 34 |
+
background: var(--surface);
|
| 35 |
+
}
|
| 36 |
+
header h1 {
|
| 37 |
+
margin: 0;
|
| 38 |
+
font-weight: 600;
|
| 39 |
+
font-size: clamp(1.5rem, 2.5vw, 2.2rem);
|
| 40 |
+
}
|
| 41 |
+
nav {
|
| 42 |
+
position: sticky;
|
| 43 |
+
top: 0;
|
| 44 |
+
background: var(--surface);
|
| 45 |
+
border-bottom: 1px solid var(--border);
|
| 46 |
+
z-index: 10;
|
| 47 |
+
}
|
| 48 |
+
nav ul {
|
| 49 |
+
display: flex;
|
| 50 |
+
gap: 1rem;
|
| 51 |
+
list-style: none;
|
| 52 |
+
margin: 0;
|
| 53 |
+
padding: .75rem 1rem;
|
| 54 |
+
overflow-x: auto;
|
| 55 |
+
}
|
| 56 |
+
nav a {
|
| 57 |
+
color: var(--text-muted);
|
| 58 |
+
text-decoration: none;
|
| 59 |
+
font-size: .875rem;
|
| 60 |
+
font-weight: 500;
|
| 61 |
+
white-space: nowrap;
|
| 62 |
+
transition: color .15s;
|
| 63 |
+
}
|
| 64 |
+
nav a:hover,
|
| 65 |
+
nav a:focus {
|
| 66 |
+
color: var(--accent);
|
| 67 |
+
}
|
| 68 |
+
main {
|
| 69 |
+
max-width: 900px;
|
| 70 |
+
margin: 0 auto;
|
| 71 |
+
padding: 2rem 1rem;
|
| 72 |
+
}
|
| 73 |
+
section {
|
| 74 |
+
scroll-margin-top: 4rem;
|
| 75 |
+
}
|
| 76 |
+
h2 {
|
| 77 |
+
margin: 2.5rem 0 1rem;
|
| 78 |
+
font-size: clamp(1.25rem, 2.2vw, 1.75rem);
|
| 79 |
+
font-weight: 600;
|
| 80 |
+
color: var(--text);
|
| 81 |
+
border-bottom: 1px solid var(--border);
|
| 82 |
+
padding-bottom: .25rem;
|
| 83 |
+
}
|
| 84 |
+
h3 {
|
| 85 |
+
margin: 1.5rem 0 .75rem;
|
| 86 |
+
font-size: 1.1rem;
|
| 87 |
+
font-weight: 600;
|
| 88 |
+
color: var(--text);
|
| 89 |
+
}
|
| 90 |
+
p, li {
|
| 91 |
+
color: var(--text-muted);
|
| 92 |
+
font-size: .95rem;
|
| 93 |
+
}
|
| 94 |
+
ul {
|
| 95 |
+
padding-left: 1.25rem;
|
| 96 |
+
}
|
| 97 |
+
code, pre {
|
| 98 |
+
font-family: var(--mono);
|
| 99 |
+
font-size: .875rem;
|
| 100 |
+
}
|
| 101 |
+
pre {
|
| 102 |
+
background: var(--code-bg);
|
| 103 |
+
border: 1px solid var(--code-border);
|
| 104 |
+
padding: 1rem;
|
| 105 |
+
border-radius: .375rem;
|
| 106 |
+
overflow-x: auto;
|
| 107 |
+
white-space: pre;
|
| 108 |
+
}
|
| 109 |
+
.highlight {
|
| 110 |
+
color: var(--accent);
|
| 111 |
+
}
|
| 112 |
+
details {
|
| 113 |
+
margin-top: 1rem;
|
| 114 |
+
border: 1px solid var(--border);
|
| 115 |
+
border-radius: .375rem;
|
| 116 |
+
background: var(--surface);
|
| 117 |
+
}
|
| 118 |
+
summary {
|
| 119 |
+
padding: .75rem 1rem;
|
| 120 |
+
cursor: pointer;
|
| 121 |
+
font-weight: 500;
|
| 122 |
+
outline: none;
|
| 123 |
+
}
|
| 124 |
+
summary:focus-visible {
|
| 125 |
+
outline: 2px solid var(--accent);
|
| 126 |
+
outline-offset: -2px;
|
| 127 |
+
}
|
| 128 |
+
details[open] pre {
|
| 129 |
+
margin: 0;
|
| 130 |
+
border: none;
|
| 131 |
+
border-top: 1px solid var(--border);
|
| 132 |
+
border-radius: 0;
|
| 133 |
+
}
|
| 134 |
+
.tabs {
|
| 135 |
+
display: flex;
|
| 136 |
+
gap: .5rem;
|
| 137 |
+
border-bottom: 1px solid var(--border);
|
| 138 |
+
margin-bottom: 1rem;
|
| 139 |
+
}
|
| 140 |
+
.tab {
|
| 141 |
+
background: none;
|
| 142 |
+
border: none;
|
| 143 |
+
color: var(--text-muted);
|
| 144 |
+
padding: .5rem .75rem;
|
| 145 |
+
cursor: pointer;
|
| 146 |
+
font-size: .875rem;
|
| 147 |
+
font-weight: 500;
|
| 148 |
+
border-bottom: 2px solid transparent;
|
| 149 |
+
transition: all .15s;
|
| 150 |
+
}
|
| 151 |
+
.tab.active,
|
| 152 |
+
.tab:hover {
|
| 153 |
+
color: var(--accent);
|
| 154 |
+
border-color: var(--accent);
|
| 155 |
+
}
|
| 156 |
+
.tab-content {
|
| 157 |
+
display: none;
|
| 158 |
+
}
|
| 159 |
+
.tab-content.active {
|
| 160 |
+
display: block;
|
| 161 |
+
}
|
| 162 |
+
@media (min-width: 600px) {
|
| 163 |
+
nav ul {
|
| 164 |
+
justify-content: center;
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
</style>
|
| 168 |
+
</head>
|
| 169 |
+
<body>
|
| 170 |
+
<header>
|
| 171 |
+
<h1>Protocol Buffers – Well-Known Types</h1>
|
| 172 |
+
</header>
|
| 173 |
+
<nav>
|
| 174 |
+
<ul>
|
| 175 |
+
<li><a href="#overview">Overview</a></li>
|
| 176 |
+
<li><a href="#projections">Field Masks in Projections</a></li>
|
| 177 |
+
<li><a href="#updates">Field Masks in Update Operations</a></li>
|
| 178 |
+
<li><a href="#json">JSON Encoding</a></li>
|
| 179 |
+
<li><a href="#oneof">Oneof Fields</a></li>
|
| 180 |
+
<li><a href="#verification">Field Mask Verification</a></li>
|
| 181 |
+
</ul>
|
| 182 |
+
</nav>
|
| 183 |
+
|
| 184 |
+
<main>
|
| 185 |
+
<section id="overview">
|
| 186 |
+
<h2>Overview</h2>
|
| 187 |
+
<p>
|
| 188 |
+
<code class="highlight">FieldMask</code> represents a set of symbolic field paths, for example:
|
| 189 |
+
</p>
|
| 190 |
+
<pre>paths: "f.a"
|
| 191 |
+
paths: "f.b.d"</pre>
|
| 192 |
+
<p>
|
| 193 |
+
Here <code>f</code> represents a field in some root message, <code>a</code> and <code>b</code>
|
| 194 |
+
fields in the message found in <code>f</code>, and <code>d</code> a field found in the
|
| 195 |
+
message in <code>f.b</code>.
|
| 196 |
+
</p>
|
| 197 |
+
</section>
|
| 198 |
+
|
| 199 |
+
<section id="projections">
|
| 200 |
+
<h2>Field Masks in Projections</h2>
|
| 201 |
+
<p>
|
| 202 |
+
When used in the context of a projection, a response message or
|
| 203 |
+
sub-message is filtered by the API to only contain those fields as
|
| 204 |
+
specified in the mask.
|
| 205 |
+
</p>
|
| 206 |
+
<details>
|
| 207 |
+
<summary>Example</summary>
|
| 208 |
+
<pre>f {
|
| 209 |
+
a : 22
|
| 210 |
+
b {
|
| 211 |
+
d : 1
|
| 212 |
+
x : 2
|
| 213 |
+
}
|
| 214 |
+
y : 13
|
| 215 |
+
}
|
| 216 |
+
z: 8</pre>
|
| 217 |
+
<p>The result will <strong>not</strong> contain specific values for fields <code>x,y</code> and <code>z</code>:</p>
|
| 218 |
+
<pre>f {
|
| 219 |
+
a : 22
|
| 220 |
+
b {
|
| 221 |
+
d : 1
|
| 222 |
+
}
|
| 223 |
+
}</pre>
|
| 224 |
+
</details>
|
| 225 |
+
</section>
|
| 226 |
+
|
| 227 |
+
<section id="updates">
|
| 228 |
+
<h2>Field Masks in Update Operations</h2>
|
| 229 |
+
<p>
|
| 230 |
+
A field mask in update operations specifies which fields of the
|
| 231 |
+
targeted resource are going to be updated. The API is required
|
| 232 |
+
to only change the values of the fields as specified in the mask
|
| 233 |
+
and leave the others untouched.
|
| 234 |
+
</p>
|
| 235 |
+
<details>
|
| 236 |
+
<summary>Example</summary>
|
| 237 |
+
<p>Given the target message:</p>
|
| 238 |
+
<pre>f {
|
| 239 |
+
b {
|
| 240 |
+
d: 1
|
| 241 |
+
x: 2
|
| 242 |
+
}
|
| 243 |
+
c: [1]
|
| 244 |
+
}</pre>
|
| 245 |
+
<p>And an update message:</p>
|
| 246 |
+
<pre>f {
|
| 247 |
+
b {
|
| 248 |
+
d: 10
|
| 249 |
+
}
|
| 250 |
+
c: [2]
|
| 251 |
+
}</pre>
|
| 252 |
+
<p>With the field mask:</p>
|
| 253 |
+
<pre>paths: ["f.b", "f.c"]</pre>
|
| 254 |
+
<p>The result will be:</p>
|
| 255 |
+
<pre>f {
|
| 256 |
+
b {
|
| 257 |
+
d: 10
|
| 258 |
+
x: 2
|
| 259 |
+
}
|
| 260 |
+
c: [1, 2]
|
| 261 |
+
}</pre>
|
| 262 |
+
</details>
|
| 263 |
+
</section>
|
| 264 |
+
|
| 265 |
+
<section id="json">
|
| 266 |
+
<h2>JSON Encoding of Field Masks</h2>
|
| 267 |
+
<p>
|
| 268 |
+
In JSON, a field mask is encoded as a single string where paths are
|
| 269 |
+
separated by a comma. Fields name in each path are converted
|
| 270 |
+
to/from lower-camel naming conventions.
|
| 271 |
+
</p>
|
| 272 |
+
<div class="tabs">
|
| 273 |
+
<button class="tab active" data-tab="proto">Proto</button>
|
| 274 |
+
<button class="tab" data-tab="json">JSON</button>
|
| 275 |
+
</div>
|
| 276 |
+
<div class="tab-content active" id="proto">
|
| 277 |
+
<pre>mask {
|
| 278 |
+
paths: "user.display_name"
|
| 279 |
+
paths: "photo"
|
| 280 |
+
}</pre>
|
| 281 |
+
</div>
|
| 282 |
+
<div class="tab-content" id="json">
|
| 283 |
+
<pre>{
|
| 284 |
+
mask: "user.displayName,photo"
|
| 285 |
+
}</pre>
|
| 286 |
+
</div>
|
| 287 |
+
</section>
|
| 288 |
+
|
| 289 |
+
<section id="oneof">
|
| 290 |
+
<h2>Field Masks and Oneof Fields</h2>
|
| 291 |
+
<p>
|
| 292 |
+
Field masks treat fields in oneofs just as regular fields. Consider the
|
| 293 |
+
following message:
|
| 294 |
+
</p>
|
| 295 |
+
<pre>message SampleMessage {
|
| 296 |
+
oneof test_oneof {
|
| 297 |
+
string name = 4;
|
| 298 |
+
SubMessage sub_message = 9;
|
| 299 |
+
}
|
| 300 |
+
}</pre>
|
| 301 |
+
<p>
|
| 302 |
+
The field mask can be:
|
| 303 |
+
</p>
|
| 304 |
+
<pre>mask {
|
| 305 |
+
paths: "name"
|
| 306 |
+
}</pre>
|
| 307 |
+
<p>or</p>
|
| 308 |
+
<pre>mask {
|
| 309 |
+
paths: "sub_message"
|
| 310 |
+
}</pre>
|
| 311 |
+
<p>
|
| 312 |
+
Note that oneof type names (<code>test_oneof</code>) cannot be used in
|
| 313 |
+
paths.
|
| 314 |
+
</p>
|
| 315 |
+
</section>
|
| 316 |
+
|
| 317 |
+
<section id="verification">
|
| 318 |
+
<h2>Field Mask Verification</h2>
|
| 319 |
+
<p>
|
| 320 |
+
The implementation of any API method which has a <code>FieldMask</code> type field in the
|
| 321 |
+
request should verify the included field paths, and return an
|
| 322 |
+
<code>INVALID_ARGUMENT</code> error if any path is unmappable.
|
| 323 |
+
</p>
|
| 324 |
+
</section>
|
| 325 |
+
</main>
|
| 326 |
+
|
| 327 |
+
<script>
|
| 328 |
+
// Tab switching
|
| 329 |
+
document.querySelectorAll('.tab').forEach(btn => {
|
| 330 |
+
btn.addEventListener('click', () => {
|
| 331 |
+
document.querySelectorAll('.tab, .tab-content').forEach(el => el.classList.remove('active'));
|
| 332 |
+
btn.classList.add('active');
|
| 333 |
+
document.getElementById(btn.dataset.tab).classList.add('active');
|
| 334 |
+
});
|
| 335 |
+
});
|
| 336 |
+
</script>
|
| 337 |
+
</body>
|
| 338 |
+
</html>
|