Skip to content
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

Directives are not visible in the scheme #1231

Open
SpeedySH opened this issue Jul 9, 2024 · 1 comment
Open

Directives are not visible in the scheme #1231

SpeedySH opened this issue Jul 9, 2024 · 1 comment

Comments

@SpeedySH
Copy link

SpeedySH commented Jul 9, 2024

In fact, I've tried everything, the only thing left is to write directly to name :)

The situation is as follows, I'm trying to make it so that when I specify a directive object, they are drawn in the scheme. Now it does not work. According to the documentation @graphql-tools/utils, if the fields are in the field in the object "extensions.directives" - then they should be drawn, but it does not work, because I'm 10 hours running through the objects in search of the truth :(

I will be grateful for an answer, even if it is impossible to implement.

...
    args: {
      email: t.arg.string({
        description: "Email address",
        required: true,
        directives: {
          constraint: getConstraints(validateDisplayName),
          /*
          This object is in the schema, and should be rendered, but it just goes into ignore (maybe under the hood, just like rateLimit it works, but I need the schema to know about it (Primarily for Codegen on the client)).
          */
        },
      }),
      password: t.arg.string({ description: "Password", required: true }),
    },
...
@hayes
Copy link
Owner

hayes commented Jul 10, 2024

There was a decision in GraphQL a long time ago that basically resulted in the core schema printer being unable to print directives other than the built in directives like @deprecated and @OneOf

To see other directives in the schema, you need to use a custom print method. For example https://the-guild.dev/graphql/tools/docs/api/modules/utils_src#printschemawithdirectives

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