File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -384,12 +384,15 @@ function isOptional(field, syntax) {
384
384
return field . options != null && field . options [ "proto3_optional" ] === true ;
385
385
386
386
// In proto2, fields are explicitly optional if they are not part of a map, array or oneOf group
387
- return field . optional && ! ( field . partOf || field . repeated || field . map ) ;
387
+ if ( syntax === "proto2" )
388
+ return field . optional && ! ( field . partOf || field . repeated || field . map ) ;
389
+
390
+ throw new Error ( "Unknown proto syntax: [" + syntax + "]" ) ;
388
391
}
389
392
390
393
function isOptionalOneOf ( oneof , syntax ) {
391
394
392
- if ( syntax !== "proto3 ")
395
+ if ( syntax === "proto2 ")
393
396
return false ;
394
397
395
398
if ( oneof . fieldsArray == null || oneof . fieldsArray . length !== 1 )
You can’t perform that action at this time.
0 commit comments