File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
@proto-graphql/codegen-core/src/printer
protoc-gen-nexus/src/dslgen/printers Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,14 @@ export function isProtobufWrapperType(
247247 ) ;
248248}
249249
250+ export function isGoogleWellKnownType (
251+ proto : ProtoField [ "type" ]
252+ ) : proto is ProtoMessage {
253+ return (
254+ proto . kind === "Message" && proto . file . name . startsWith ( "google/type/" )
255+ ) ;
256+ }
257+
250258export function isProtobufWellKnownType (
251259 proto : ProtoField [ "type" ]
252260) : proto is ProtoMessage {
Original file line number Diff line number Diff line change 66 InputObjectType ,
77 InterfaceType ,
88 isProtobufLong ,
9+ isGoogleWellKnownType ,
910 isProtobufWellKnownType ,
1011 ObjectField ,
1112 ObjectOneofField ,
@@ -251,7 +252,7 @@ function createResolverCode(
251252 }
252253 }
253254
254- if ( isProtobufWellKnownType ( field . proto . type ) ) {
255+ if ( isProtobufWellKnownType ( field . proto . type ) || isGoogleWellKnownType ( field . proto . type ) ) {
255256 const transformer = code `${ impProtoNexus (
256257 "getTransformer"
257258 ) } ("${ field . proto . type . fullName . toString ( ) } ")`;
Original file line number Diff line number Diff line change 44 InputObjectField ,
55 InputObjectType ,
66 isProtobufLong ,
7+ isGoogleWellKnownType ,
78 isProtobufWellKnownType ,
89 protobufGraphQLExtensions ,
910 protoType ,
@@ -93,7 +94,7 @@ export function createToProtoFuncCode(
9394 type . fields . map ( ( f ) => {
9495 let wrapperFunc : ( v : Code ) => Code = ( v ) => v ;
9596 if ( f . type instanceof ScalarType ) {
96- if ( isProtobufWellKnownType ( f . proto . type ) ) {
97+ if ( isProtobufWellKnownType ( f . proto . type ) || isGoogleWellKnownType ( f . proto . type ) ) {
9798 const protoFullName = f . proto . type . fullName . toString ( ) ;
9899 const transformer = code `${ impProtoNexus (
99100 "getTransformer"
You can’t perform that action at this time.
0 commit comments