Skip to content

How to override the ID scalar? #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Colt45s opened this issue Sep 25, 2024 · 2 comments
Closed

How to override the ID scalar? #333

Colt45s opened this issue Sep 25, 2024 · 2 comments

Comments

@Colt45s
Copy link

Colt45s commented Sep 25, 2024

I am trying to implement an ID scalar according to the GraphQL Global Object Identification Specification.

codegen.ts

import { defineConfig } from "@eddeee888/gcg-typescript-resolver-files";
import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
  schema: "internal/schema/**/*.graphql",
  generates: {
    "internal/schema": defineConfig({
      scalarsOverrides: {
        ID: {
          resolver: "base/resolvers/ID#IDResolver",
        },
      },
    }),
  },
};

export default config;

base/resolvers/ID.ts

export const IDResolver = {};

No resolver is generated in resolvers.generated.ts.

@eddeee888
Copy link
Owner

Hi @Colt45s ,

It looks like you can't override default scalars like ID at runtime: graphql/graphql-js#917
Since it cannot be done at that level, I don't think we can support it at codegen level 🙂

Unless you are able to override the default scalar somehow?

@eddeee888
Copy link
Owner

Closing this as overriding default scalar is not currently supported at GraphQL level. Thanks for reaching out!

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

No branches or pull requests

2 participants