Skip to content

Commit 7502dd2

Browse files
committed
Docs: Documented that Type#encode respectively Message.encode do not implicitly .verify, see #696 [ci-skip]
1 parent e7e123a commit 7502dd2

File tree

8 files changed

+276
-276
lines changed

8 files changed

+276
-276
lines changed

cli/targets/static.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ function buildType(ref, type) {
393393
if (config.encode) {
394394
push("");
395395
pushComment([
396-
"Encodes the specified " + type.name + " message.",
396+
"Encodes the specified " + type.name + " message. Does not implicitly {@link " + fullName + ".verify|verify} messages.",
397397
"@param {" + fullName + "|Object} " + (config.beautify ? "message" : "m") + " " + type.name + " message or plain object to encode",
398398
"@param {$protobuf.Writer} [" + (config.beautify ? "writer" : "w") + "] Writer to encode to",
399399
"@returns {$protobuf.Writer} Writer"
@@ -403,7 +403,7 @@ function buildType(ref, type) {
403403
if (config.delimited) {
404404
push("");
405405
pushComment([
406-
"Encodes the specified " + type.name + " message, length delimited.",
406+
"Encodes the specified " + type.name + " message, length delimited. Does not implicitly {@link " + fullName + ".verify|verify} messages.",
407407
"@param {" + fullName + "|Object} message " + type.name + " message or plain object to encode",
408408
"@param {$protobuf.Writer} [writer] Writer to encode to",
409409
"@returns {$protobuf.Writer} Writer"

src/type.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ Type.prototype.setup = function setup() {
397397
};
398398

399399
/**
400-
* Encodes a message of this type.
400+
* Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.
401401
* @param {Message|Object} message Message instance or plain object
402402
* @param {Writer} [writer] Writer to encode to
403403
* @returns {Writer} writer
@@ -407,7 +407,7 @@ Type.prototype.encode = function encode_setup(message, writer) {
407407
};
408408

409409
/**
410-
* Encodes a message of this type preceeded by its byte length as a varint.
410+
* Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.
411411
* @param {Message|Object} message Message instance or plain object
412412
* @param {Writer} [writer] Writer to encode to
413413
* @returns {Writer} writer

tests/data/comments.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ $root.Test1 = (function() {
5858
};
5959

6060
/**
61-
* Encodes the specified Test1 message.
61+
* Encodes the specified Test1 message. Does not implicitly {@link Test1.verify|verify} messages.
6262
* @param {Test1|Object} message Test1 message or plain object to encode
6363
* @param {$protobuf.Writer} [writer] Writer to encode to
6464
* @returns {$protobuf.Writer} Writer
@@ -76,7 +76,7 @@ $root.Test1 = (function() {
7676
};
7777

7878
/**
79-
* Encodes the specified Test1 message, length delimited.
79+
* Encodes the specified Test1 message, length delimited. Does not implicitly {@link Test1.verify|verify} messages.
8080
* @param {Test1|Object} message Test1 message or plain object to encode
8181
* @param {$protobuf.Writer} [writer] Writer to encode to
8282
* @returns {$protobuf.Writer} Writer
@@ -90,7 +90,7 @@ $root.Test1 = (function() {
9090
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
9191
* @param {number} [length] Message length if known beforehand
9292
* @returns {Test1} Test1
93-
* @throws {Error} If the payload is invalid or missing required fields
93+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
9494
*/
9595
Test1.decode = function decode(reader, length) {
9696
if (!(reader instanceof $Reader))
@@ -120,7 +120,7 @@ $root.Test1 = (function() {
120120
* Decodes a Test1 message from the specified reader or buffer, length delimited.
121121
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
122122
* @returns {Test1} Test1
123-
* @throws {Error} If the payload is invalid or missing required fields
123+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
124124
*/
125125
Test1.decodeDelimited = function decodeDelimited(reader) {
126126
if (!(reader instanceof $Reader))
@@ -243,7 +243,7 @@ $root.Test2 = (function() {
243243
};
244244

245245
/**
246-
* Encodes the specified Test2 message.
246+
* Encodes the specified Test2 message. Does not implicitly {@link Test2.verify|verify} messages.
247247
* @param {Test2|Object} message Test2 message or plain object to encode
248248
* @param {$protobuf.Writer} [writer] Writer to encode to
249249
* @returns {$protobuf.Writer} Writer
@@ -255,7 +255,7 @@ $root.Test2 = (function() {
255255
};
256256

257257
/**
258-
* Encodes the specified Test2 message, length delimited.
258+
* Encodes the specified Test2 message, length delimited. Does not implicitly {@link Test2.verify|verify} messages.
259259
* @param {Test2|Object} message Test2 message or plain object to encode
260260
* @param {$protobuf.Writer} [writer] Writer to encode to
261261
* @returns {$protobuf.Writer} Writer
@@ -269,7 +269,7 @@ $root.Test2 = (function() {
269269
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
270270
* @param {number} [length] Message length if known beforehand
271271
* @returns {Test2} Test2
272-
* @throws {Error} If the payload is invalid or missing required fields
272+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
273273
*/
274274
Test2.decode = function decode(reader, length) {
275275
if (!(reader instanceof $Reader))
@@ -290,7 +290,7 @@ $root.Test2 = (function() {
290290
* Decodes a Test2 message from the specified reader or buffer, length delimited.
291291
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
292292
* @returns {Test2} Test2
293-
* @throws {Error} If the payload is invalid or missing required fields
293+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
294294
*/
295295
Test2.decodeDelimited = function decodeDelimited(reader) {
296296
if (!(reader instanceof $Reader))

tests/data/convert.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ $root.Message = (function() {
9696
};
9797

9898
/**
99-
* Encodes the specified Message message.
99+
* Encodes the specified Message message. Does not implicitly {@link Message.verify|verify} messages.
100100
* @param {Message|Object} message Message message or plain object to encode
101101
* @param {$protobuf.Writer} [writer] Writer to encode to
102102
* @returns {$protobuf.Writer} Writer
@@ -137,7 +137,7 @@ $root.Message = (function() {
137137
};
138138

139139
/**
140-
* Encodes the specified Message message, length delimited.
140+
* Encodes the specified Message message, length delimited. Does not implicitly {@link Message.verify|verify} messages.
141141
* @param {Message|Object} message Message message or plain object to encode
142142
* @param {$protobuf.Writer} [writer] Writer to encode to
143143
* @returns {$protobuf.Writer} Writer
@@ -151,7 +151,7 @@ $root.Message = (function() {
151151
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
152152
* @param {number} [length] Message length if known beforehand
153153
* @returns {Message} Message
154-
* @throws {Error} If the payload is invalid or missing required fields
154+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
155155
*/
156156
Message.decode = function decode(reader, length) {
157157
if (!(reader instanceof $Reader))
@@ -222,7 +222,7 @@ $root.Message = (function() {
222222
* Decodes a Message message from the specified reader or buffer, length delimited.
223223
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
224224
* @returns {Message} Message
225-
* @throws {Error} If the payload is invalid or missing required fields
225+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
226226
*/
227227
Message.decodeDelimited = function decodeDelimited(reader) {
228228
if (!(reader instanceof $Reader))

tests/data/mapbox/vector_tile.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ $root.vector_tile = (function() {
5656
};
5757

5858
/**
59-
* Encodes the specified Tile message.
59+
* Encodes the specified Tile message. Does not implicitly {@link vector_tile.Tile.verify|verify} messages.
6060
* @param {vector_tile.Tile|Object} message Tile message or plain object to encode
6161
* @param {$protobuf.Writer} [writer] Writer to encode to
6262
* @returns {$protobuf.Writer} Writer
@@ -71,7 +71,7 @@ $root.vector_tile = (function() {
7171
};
7272

7373
/**
74-
* Encodes the specified Tile message, length delimited.
74+
* Encodes the specified Tile message, length delimited. Does not implicitly {@link vector_tile.Tile.verify|verify} messages.
7575
* @param {vector_tile.Tile|Object} message Tile message or plain object to encode
7676
* @param {$protobuf.Writer} [writer] Writer to encode to
7777
* @returns {$protobuf.Writer} Writer
@@ -85,7 +85,7 @@ $root.vector_tile = (function() {
8585
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
8686
* @param {number} [length] Message length if known beforehand
8787
* @returns {vector_tile.Tile} Tile
88-
* @throws {Error} If the payload is invalid or missing required fields
88+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
8989
*/
9090
Tile.decode = function decode(reader, length) {
9191
if (!(reader instanceof $Reader))
@@ -111,7 +111,7 @@ $root.vector_tile = (function() {
111111
* Decodes a Tile message from the specified reader or buffer, length delimited.
112112
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
113113
* @returns {vector_tile.Tile} Tile
114-
* @throws {Error} If the payload is invalid or missing required fields
114+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
115115
*/
116116
Tile.decodeDelimited = function decodeDelimited(reader) {
117117
if (!(reader instanceof $Reader))
@@ -292,7 +292,7 @@ $root.vector_tile = (function() {
292292
};
293293

294294
/**
295-
* Encodes the specified Value message.
295+
* Encodes the specified Value message. Does not implicitly {@link vector_tile.Tile.Value.verify|verify} messages.
296296
* @param {vector_tile.Tile.Value|Object} message Value message or plain object to encode
297297
* @param {$protobuf.Writer} [writer] Writer to encode to
298298
* @returns {$protobuf.Writer} Writer
@@ -318,7 +318,7 @@ $root.vector_tile = (function() {
318318
};
319319

320320
/**
321-
* Encodes the specified Value message, length delimited.
321+
* Encodes the specified Value message, length delimited. Does not implicitly {@link vector_tile.Tile.Value.verify|verify} messages.
322322
* @param {vector_tile.Tile.Value|Object} message Value message or plain object to encode
323323
* @param {$protobuf.Writer} [writer] Writer to encode to
324324
* @returns {$protobuf.Writer} Writer
@@ -332,7 +332,7 @@ $root.vector_tile = (function() {
332332
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
333333
* @param {number} [length] Message length if known beforehand
334334
* @returns {vector_tile.Tile.Value} Value
335-
* @throws {Error} If the payload is invalid or missing required fields
335+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
336336
*/
337337
Value.decode = function decode(reader, length) {
338338
if (!(reader instanceof $Reader))
@@ -374,7 +374,7 @@ $root.vector_tile = (function() {
374374
* Decodes a Value message from the specified reader or buffer, length delimited.
375375
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
376376
* @returns {vector_tile.Tile.Value} Value
377-
* @throws {Error} If the payload is invalid or missing required fields
377+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
378378
*/
379379
Value.decodeDelimited = function decodeDelimited(reader) {
380380
if (!(reader instanceof $Reader))
@@ -600,7 +600,7 @@ $root.vector_tile = (function() {
600600
};
601601

602602
/**
603-
* Encodes the specified Feature message.
603+
* Encodes the specified Feature message. Does not implicitly {@link vector_tile.Tile.Feature.verify|verify} messages.
604604
* @param {vector_tile.Tile.Feature|Object} message Feature message or plain object to encode
605605
* @param {$protobuf.Writer} [writer] Writer to encode to
606606
* @returns {$protobuf.Writer} Writer
@@ -628,7 +628,7 @@ $root.vector_tile = (function() {
628628
};
629629

630630
/**
631-
* Encodes the specified Feature message, length delimited.
631+
* Encodes the specified Feature message, length delimited. Does not implicitly {@link vector_tile.Tile.Feature.verify|verify} messages.
632632
* @param {vector_tile.Tile.Feature|Object} message Feature message or plain object to encode
633633
* @param {$protobuf.Writer} [writer] Writer to encode to
634634
* @returns {$protobuf.Writer} Writer
@@ -642,7 +642,7 @@ $root.vector_tile = (function() {
642642
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
643643
* @param {number} [length] Message length if known beforehand
644644
* @returns {vector_tile.Tile.Feature} Feature
645-
* @throws {Error} If the payload is invalid or missing required fields
645+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
646646
*/
647647
Feature.decode = function decode(reader, length) {
648648
if (!(reader instanceof $Reader))
@@ -689,7 +689,7 @@ $root.vector_tile = (function() {
689689
* Decodes a Feature message from the specified reader or buffer, length delimited.
690690
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
691691
* @returns {vector_tile.Tile.Feature} Feature
692-
* @throws {Error} If the payload is invalid or missing required fields
692+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
693693
*/
694694
Feature.decodeDelimited = function decodeDelimited(reader) {
695695
if (!(reader instanceof $Reader))
@@ -925,7 +925,7 @@ $root.vector_tile = (function() {
925925
};
926926

927927
/**
928-
* Encodes the specified Layer message.
928+
* Encodes the specified Layer message. Does not implicitly {@link vector_tile.Tile.Layer.verify|verify} messages.
929929
* @param {vector_tile.Tile.Layer|Object} message Layer message or plain object to encode
930930
* @param {$protobuf.Writer} [writer] Writer to encode to
931931
* @returns {$protobuf.Writer} Writer
@@ -950,7 +950,7 @@ $root.vector_tile = (function() {
950950
};
951951

952952
/**
953-
* Encodes the specified Layer message, length delimited.
953+
* Encodes the specified Layer message, length delimited. Does not implicitly {@link vector_tile.Tile.Layer.verify|verify} messages.
954954
* @param {vector_tile.Tile.Layer|Object} message Layer message or plain object to encode
955955
* @param {$protobuf.Writer} [writer] Writer to encode to
956956
* @returns {$protobuf.Writer} Writer
@@ -964,7 +964,7 @@ $root.vector_tile = (function() {
964964
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
965965
* @param {number} [length] Message length if known beforehand
966966
* @returns {vector_tile.Tile.Layer} Layer
967-
* @throws {Error} If the payload is invalid or missing required fields
967+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
968968
*/
969969
Layer.decode = function decode(reader, length) {
970970
if (!(reader instanceof $Reader))
@@ -1013,7 +1013,7 @@ $root.vector_tile = (function() {
10131013
* Decodes a Layer message from the specified reader or buffer, length delimited.
10141014
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
10151015
* @returns {vector_tile.Tile.Layer} Layer
1016-
* @throws {Error} If the payload is invalid or missing required fields
1016+
* @throws {Error} If the payload is not a reader or valid buffer or required fields are missing
10171017
*/
10181018
Layer.decodeDelimited = function decodeDelimited(reader) {
10191019
if (!(reader instanceof $Reader))

0 commit comments

Comments
 (0)