Skip to content

Conversation

mvn-namnguyen-dn
Copy link

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)

Related issue

#315

Copy link

changeset-bot bot commented Nov 20, 2023

🦋 Changeset detected

Latest commit: 04ece3f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@proto-graphql/codegen-core Patch
protoc-gen-nexus Patch
@proto-graphql/protoc-plugin-helpers Patch
protoc-gen-pothos Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant