Skip to content

Include FDC custom scalar types with schema definition.#1814

Merged
rosalyntan merged 3 commits intomasterfrom
rosalyntan.scalar
Feb 13, 2026
Merged

Include FDC custom scalar types with schema definition.#1814
rosalyntan merged 3 commits intomasterfrom
rosalyntan.scalar

Conversation

@rosalyntan
Copy link
Copy Markdown
Member

@rosalyntan rosalyntan commented Feb 11, 2026

Description

Add FDC custom scalar types (Any, Void, Date, etc.) into the developers GraphQL schema definition, so developers do not need to redefine these scalars themselves.

Code sample

# Example Firebase Data Connect schema
type Query {
  hello(name: String): String
  wrapAny(input: Any): Any
}
# Example Firebase Data Connect connector
query SayHello @auth(level: PUBLIC, insecureReason: "Anyone can say hello.") {
  hello(name: "Firebase")
  wrapAny(input: {foo: "bar", num: 42, nested: {a: 1, b: 2}})
}
// Example Firebase Functions code
import {setGlobalOptions} from "firebase-functions";
import {
  FirebaseContext,
  onGraphRequest,
} from "firebase-functions/dataconnect/graphql";

const opts = {
  schemaFilePath: "dataconnect/schema_resolver/schema.gql",
  resolvers: {
    query: {
      // This resolver function populates the data for the "hello" field
      // defined in your GraphQL schema located at schemaFilePath.
      hello(
        _parent: unknown,
        args: Record<string, unknown>,
        _contextValue: FirebaseContext,
        _info: unknown
      ): string {
        return `Hello ${args.name}!`;
      },
      wrapAny(
        _parent: unknown,
        args: Record<string, unknown>,
        _contextValue: FirebaseContext,
        _info: unknown
      ): any {
        // This resolver wraps around the input and returns it with some additional fields.
        return {input: args.input, field: "value", nestedField: {subField: 123}};
      }
    },
  },
};

export const resolver = onGraphRequest(opts);
# Example request and response

$ curl -H "Content-Type: application/json"   "https://staging-firebasedataconnect.sandbox.googleapis.com/v1/projects/test-rosalyntan/locations/us-central1/services/test-rosalyntan/connectors/example:executeQuery" --data "{\"operationName\": \"SayHello\"}"

{
  "data": {
    "hello": "Hello Firebase!",
    "wrapAny": {
      "input": {
        "nested": {
          "b": 2,
          "a": 1
        },
        "num": 42,
        "foo": "bar"
      },
      "nestedField": {
        "subField": 123
      },
      "field": "value"
    }
  }
}

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @rosalyntan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request streamlines the GraphQL server setup for Firebase Data Connect by automatically injecting a set of common FDC-specific custom scalar types into the schema. This enhancement simplifies schema definition for developers by providing built-in support for these data types, reducing boilerplate and improving consistency across FDC GraphQL implementations.

Highlights

  • Custom Scalar Types: Added a predefined set of custom GraphQL scalar types (UUID, Int64, Any, Void, True, Date, Timestamp) to support Firebase Data Connect (FDC) functionalities.
  • Schema Integration: Modified the GraphQL server initialization to automatically prepend these custom scalar definitions to the user-provided schema, ensuring they are always available.
  • Apollo Server Configuration: Updated the Apollo Server configuration to utilize the combined schema, which now includes the newly defined FDC custom scalars.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/v2/providers/dataconnect/graphql.ts
    • Defined a new constant PRELUDE_GQL containing GraphQL scalar definitions for types like UUID, Int64, Any, Void, True, Date, and Timestamp.
    • Introduced a schemaWithPrelude variable that combines the PRELUDE_GQL with the existing opts.schema.
    • Updated the ApolloServer's typeDefs property to use schemaWithPrelude, ensuring the custom scalars are included in the server's schema.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for Firebase Data Connect (FDC) custom scalar types by prepending them to the GraphQL schema. While this is a good feature, the current implementation could introduce a breaking change for users who have defined their own scalars with the same names. My main feedback is to make this feature opt-out to ensure backward compatibility. I've also included a suggestion to improve the readability and maintainability of how the new GraphQL scalars are defined.

@rosalyntan rosalyntan marked this pull request as ready for review February 12, 2026 18:40
@rosalyntan rosalyntan added this pull request to the merge queue Feb 13, 2026
Merged via the queue into master with commit 8c9dc96 Feb 13, 2026
32 checks passed
@rosalyntan rosalyntan deleted the rosalyntan.scalar branch February 13, 2026 21:39
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.

3 participants