@@ -418,60 +418,57 @@ fn extract_message_graphql_directives_from_options(message: &DescriptorProto, tr
418418 use protobuf:: Message ;
419419 if let Ok ( derive_field_proto) =
420420 crate :: options_proto:: options:: DeriveField :: parse_from_bytes ( bytes)
421+ && derive_field_proto. has_entity ( )
421422 {
422- if derive_field_proto. has_entity ( ) {
423- translated_message. derive_fields . push ( crate :: schema:: DeriveField {
424- entity : derive_field_proto. entity ( ) . to_owned ( ) ,
425- name : if derive_field_proto. has_name ( ) {
426- Some ( derive_field_proto. name ( ) . to_owned ( ) )
427- } else {
428- None
429- } ,
430- is : if derive_field_proto. has_is ( ) {
431- match derive:: extract_is ( derive_field_proto. is ( ) ) {
432- Ok ( is) => Some ( is) ,
433- Err ( err) => {
434- eprintln ! ( "Error reading derive_field.is at {}: {err}" , message. name( ) ) ;
435- None
436- }
423+ translated_message. derive_fields . push ( crate :: schema:: DeriveField {
424+ entity : derive_field_proto. entity ( ) . to_owned ( ) ,
425+ name : if derive_field_proto. has_name ( ) {
426+ Some ( derive_field_proto. name ( ) . to_owned ( ) )
427+ } else {
428+ None
429+ } ,
430+ is : if derive_field_proto. has_is ( ) {
431+ match derive:: extract_is ( derive_field_proto. is ( ) ) {
432+ Ok ( is) => Some ( is) ,
433+ Err ( err) => {
434+ eprintln ! ( "Error reading derive_field.is at {}: {err}" , message. name( ) ) ;
435+ None
437436 }
438- } else {
439- None
440- } ,
441- } ) ;
442- }
437+ }
438+ } else {
439+ None
440+ } ,
441+ } ) ;
443442 }
444443 }
445444 }
446445 KEY => {
447446 if let protobuf:: UnknownValueRef :: LengthDelimited ( bytes) = value {
448447 use protobuf:: Message ;
449- if let Ok ( key_proto) = crate :: options_proto:: options:: Key :: parse_from_bytes ( bytes) {
450- if key_proto. has_fields ( ) {
451- translated_message . keys . push ( crate :: schema :: Key {
452- fields : key_proto . fields ( ) . to_owned ( ) ,
453- } ) ;
454- }
448+ if let Ok ( key_proto) = crate :: options_proto:: options:: Key :: parse_from_bytes ( bytes)
449+ && key_proto. has_fields ( )
450+ {
451+ translated_message . keys . push ( crate :: schema :: Key {
452+ fields : key_proto . fields ( ) . to_owned ( ) ,
453+ } ) ;
455454 }
456455 }
457456 }
458457 JOIN_FIELD => {
459458 if let protobuf:: UnknownValueRef :: LengthDelimited ( bytes) = value {
460459 use protobuf:: Message ;
461460 if let Ok ( join_field_proto) = crate :: options_proto:: options:: JoinField :: parse_from_bytes ( bytes)
461+ && join_field_proto. has_name ( )
462+ && join_field_proto. has_service ( )
463+ && join_field_proto. has_method ( )
464+ && join_field_proto. has_require ( )
462465 {
463- if join_field_proto. has_name ( )
464- && join_field_proto. has_service ( )
465- && join_field_proto. has_method ( )
466- && join_field_proto. has_require ( )
467- {
468- translated_message. join_fields . push ( crate :: schema:: JoinField {
469- name : join_field_proto. name ( ) . to_owned ( ) ,
470- service : join_field_proto. service ( ) . to_owned ( ) ,
471- method : join_field_proto. method ( ) . to_owned ( ) ,
472- require : join_field_proto. require ( ) . to_owned ( ) ,
473- } ) ;
474- }
466+ translated_message. join_fields . push ( crate :: schema:: JoinField {
467+ name : join_field_proto. name ( ) . to_owned ( ) ,
468+ service : join_field_proto. service ( ) . to_owned ( ) ,
469+ method : join_field_proto. method ( ) . to_owned ( ) ,
470+ require : join_field_proto. require ( ) . to_owned ( ) ,
471+ } ) ;
475472 }
476473 }
477474 }
0 commit comments