pothos icon indicating copy to clipboard operation
pothos copied to clipboard

Directives are not visible in the scheme

Open RainyPixel opened this issue 1 year ago • 1 comments

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 }),
    },
...

RainyPixel avatar Jul 09 '24 14:07 RainyPixel

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

hayes avatar Jul 10 '24 03:07 hayes