Skip to content

Commit bee997d

Browse files
Update PBJS and README for new --null-semantics flag
1 parent ed5980c commit bee997d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cli/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ Translates between file formats and generates static code.
6868
--force-long Enforces the use of 'Long' for s-/u-/int64 and s-/fixed64 fields.
6969
--force-number Enforces the use of 'number' for s-/u-/int64 and s-/fixed64 fields.
7070
--force-message Enforces the use of message instances instead of plain objects.
71-
--force-optional Enforces nullable types for fields marked as optional (proto2 and proto3)
71+
72+
--null-semantics Make nullable fields match protobuf semantics (including the optional keyword)
73+
--null-defaults Default value for optional fields is null instead of zero value (no effect if --null-semantics is specified)
7274
7375
usage: pbjs [options] file1.proto file2.json ... (or pipe) other | pbjs [options] -
7476
```

cli/pbjs.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ exports.main = function main(args, callback) {
4141
"force-message": "strict-message"
4242
},
4343
string: [ "target", "out", "path", "wrap", "dependency", "root", "lint", "filter" ],
44-
boolean: [ "create", "encode", "decode", "verify", "convert", "delimited", "typeurl", "beautify", "comments", "service", "es6", "sparse", "keep-case", "alt-comment", "force-long", "force-number", "force-enum-string", "force-message", "force-optional", "null-defaults"],
44+
boolean: [ "create", "encode", "decode", "verify", "convert", "delimited", "typeurl", "beautify", "comments", "service", "es6", "sparse", "keep-case", "alt-comment", "force-long", "force-number", "force-enum-string", "force-message", "null-semantics", "null-defaults"],
4545
default: {
4646
target: "json",
4747
create: true,
@@ -62,7 +62,7 @@ exports.main = function main(args, callback) {
6262
"force-number": false,
6363
"force-enum-string": false,
6464
"force-message": false,
65-
"force-optional": false,
65+
"null-semantics": false,
6666
"null-defaults": false
6767
}
6868
});
@@ -147,9 +147,9 @@ exports.main = function main(args, callback) {
147147
" --force-long Enforces the use of 'Long' for s-/u-/int64 and s-/fixed64 fields.",
148148
" --force-number Enforces the use of 'number' for s-/u-/int64 and s-/fixed64 fields.",
149149
" --force-message Enforces the use of message instances instead of plain objects.",
150-
" --force-optional Enforces nullable types for fields marked as optional (proto2 and proto3)",
151150
"",
152-
" --null-defaults Default value for optional fields is null instead of zero value (deprecated, use --force-optional instead)",
151+
" --null-semantics Make nullable fields match protobuf semantics (including the optional keyword)",
152+
" --null-defaults Default value for optional fields is null instead of zero value (no effect if --null-semantics is specified)",
153153
"",
154154
"usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..." + chalk.gray(" (or pipe) ") + "other | " + chalk.bold.green("pbjs") + " [options] -",
155155
""

0 commit comments

Comments
 (0)