Schema directives do not appear in the Sandbox

I just noticed that directives do not appear in the Sandbox or Studio schema reference/sdl.

I was wondering if this was done on purpose?
Is it a security thing?

I just did a quick test and was able to add a schema directive, it shows in the schema section of Studio for me. Are you using federation? If so, make sure you use @composeDirective. If not, how are you uploading your schema to Studio?

Hmm, I am using the Classic Graphs, I see the directives in the schema section under directives but I don’t see them besides the fields, queries or mutations that I applied them too.

For example:

type Mutation {
   myMutation: Boolean! @someDirective

This doesn’t appear when I lookup that mutation in the schema section for that specific mutation.
But I do see the @someDirective definition under directives.
I was expecting it to appear besides the fields that its used when looking at the schema or sdl online or in the playground.

I see it in the “details” of a field in my classic graph (screenshot attached), so it’s definitely possible. It’s also in my SDL, though. Are you updating your schema via introspection or uploading the definition itself? Introspection doesn’t usually include directives, I think.

1 Like

Ahh, I am using Introspection query.
I think this might be the reason why.
How do people usually handle this if they have Classic Graphs and need the Introspection result to be used in their backends?

Most frameworks have a way to export the full SDL including directives—you’ll have to look at options for your particular framework. Then, the rover CLI has a set of graph commands which work for classic graphs, so rover graph publish can publish your schema.

1 Like

You can also use rover graph introspect to verify what is coming back from normal introspection.

1 Like