Skip to content

GraphQL Security Directives

Pre-release
Pre-release

Choose a tag to compare

@chrissm79 chrissm79 released this 08 May 21:25
· 3658 commits to master since this release

Created @security directive which can be set on the Query type with the following options:

type Query @security(introspection: false, depth: 10, complexity: 100) {
    # ...
}

A new @complexity directive has been created which can be attached to fields to calculate complexity (default calculation provided for relationships):

type User {
    # default calculation
    posts: [Post!]! @hasMany @complexity

    # custom calculation
    posts: [Post!]! @hasMany @complexity(resolver: "App\\Http\\GraphQL\\Complexity::userPosts")
}

Read More: https://webonyx.github.io/graphql-php/security/