-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from jhnnsrs/list-directive
adds ability to add list_fields to directives
- Loading branch information
Showing
9 changed files
with
247 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
query X { | ||
x | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
from ...utils import build_relative_glob, unit_test_with | ||
from turms.config import GeneratorConfig | ||
from turms.run import generate_ast | ||
from turms.plugins.enums import EnumsPlugin | ||
from turms.plugins.inputs import InputsPlugin | ||
from turms.plugins.fragments import FragmentsPlugin | ||
from turms.plugins.operations import OperationsPlugin | ||
from turms.plugins.funcs import ( | ||
FunctionDefinition, | ||
FuncsPlugin, | ||
FuncsPluginConfig, | ||
) | ||
from turms.plugins.strawberry import StrawberryPlugin | ||
from turms.stylers.snake_case import SnakeCaseStyler | ||
from turms.stylers.capitalize import CapitalizeStyler | ||
from turms.run import generate_ast | ||
|
||
|
||
def test_list_directive_funcs(directive_schema): | ||
config = GeneratorConfig( | ||
documents=build_relative_glob("/documents/directives/*.graphql"), | ||
) | ||
generated_ast = generate_ast( | ||
config, | ||
directive_schema, | ||
stylers=[CapitalizeStyler(), SnakeCaseStyler()], | ||
plugins=[ | ||
StrawberryPlugin(), | ||
], | ||
) | ||
|
||
unit_test_with( | ||
generated_ast, | ||
"" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
The directive is responsible for authorization check. | ||
""" | ||
directive @auth( | ||
""" | ||
Permissions which are required for field access. | ||
""" | ||
permissions: [String!] | ||
|
||
""" | ||
The list of roles that an authorized user should have to get the access. | ||
""" | ||
roles: [String!] = [] | ||
) on FIELD_DEFINITION | ||
|
||
type X { | ||
name: String! @auth(permissions: ["read"]) | ||
} | ||
|
||
type Query { | ||
x: [X!]! @auth(permissions: ["read"]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters