File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -394,8 +394,7 @@ function buildType(ref, type) {
394
394
if ( config . comments ) {
395
395
push ( "" ) ;
396
396
var jsType = toJsType ( field ) ;
397
- if ( field . optional && ! field . map && ! field . repeated && field . resolvedType instanceof Type ||
398
- field . options && field . options . proto3_optional )
397
+ if ( field . optional && ! field . map && ! field . repeated && field . resolvedType instanceof Type || field . partOf )
399
398
jsType = jsType + "|null|undefined" ;
400
399
pushComment ( [
401
400
field . comment || type . name + " " + field . name + "." ,
@@ -411,9 +410,8 @@ function buildType(ref, type) {
411
410
push ( escapeName ( type . name ) + ".prototype" + prop + " = $util.emptyArray;" ) ; // overwritten in constructor
412
411
else if ( field . map )
413
412
push ( escapeName ( type . name ) + ".prototype" + prop + " = $util.emptyObject;" ) ; // overwritten in constructor
414
- else if ( field . options && field . options . proto3_optional ) {
415
- push ( escapeName ( type . name ) + ".prototype" + prop + " = null;" ) ; // do not set default value for proto3 optional fields
416
- }
413
+ else if ( field . partOf )
414
+ push ( escapeName ( type . name ) + ".prototype" + prop + " = null;" ) ; // do not set default value for oneof members
417
415
else if ( field . long )
418
416
push ( escapeName ( type . name ) + ".prototype" + prop + " = $util.Long ? $util.Long.fromBits("
419
417
+ JSON . stringify ( field . typeDefault . low ) + ","
You can’t perform that action at this time.
0 commit comments