Faisal Manzer
Faisal Manzer

Reputation: 2119

Public GraphQL directives

This is my Schema.

Query {
    me: User @isAuthenticated
}

When I add @isAuthenticated it is handled on server side but in GraphQL Playground the directive doesn't show. I have some role based access system and I want to show all the role directives publicly so that API user can understand what role is wanted for which query.

Upvotes: 2

Views: 277

Answers (1)

Daniel Rearden
Daniel Rearden

Reputation: 84657

Schema directives can be used to transform the schema or add functionality to it, but they cannot be used to expose any sort of metadata to the client. There's ongoing discussion here with regards to how to implement that sort of functionality. For the time being, your best bet would be to utilize descriptions.

"""
**Required roles**: `ADMIN` 
"""
Query {
  me: User @isAuthenticated
}

Upvotes: 1

Related Questions