Skip to content

🐛🐛🐛 proto-gen-nexus for google.Type.Date issue  #315

@mvn-namnguyen-dn

Description

@mvn-namnguyen-dn

We got an error when we tried to generate the nexus field for google.Type.Date by using the proto-gen-nexus (version: 0.6.2).

Expected Behavior

  t.field("birthday", {
    type: nullable("Date"),
    resolve: (source) => {
      const value = source.getBirthday();
      if (value == null) {
        return null;
      }
      // THE EXPECTED
      return getTransformer("google.type.Date").protoToGql(value);
    },
    extensions: {
      protobufField: { name: "birthday", typeFullName: "google.type.Date" },
    },

Current Behavior

  t.field("birthday", {
      type: nullable("Date"),
      resolve: (source) => {
        const value = source.getBirthday();
        if (value == null) {
          return null;
        }
        // ACTUALITY
        return value;
      },
      extensions: {
        protobufField: { name: "birthday", typeFullName: "google.type.Date" },
      }

Root cause

The error was found when handling WellKnownType. Currently, it only handles google.protobuf type (by isProtobufWellKnownType), but does not handle google.Type (google.Type.Date)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions