diff options
author | John Estabrook <jestabro@vyos.io> | 2021-11-13 13:04:41 -0600 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2021-11-15 14:50:28 -0600 |
commit | 9e2694b24b06d928240522322c9a6d60c7a7d290 (patch) | |
tree | 5b44fc98162aa80d88dce06bab65c64cb05dcbdf /src/services/api | |
parent | eceaa3a787929f5a514b9c45da52936c0d4d4a54 (diff) | |
download | vyos-1x-9e2694b24b06d928240522322c9a6d60c7a7d290.tar.gz vyos-1x-9e2694b24b06d928240522322c9a6d60c7a7d290.zip |
graphql: T3993: move schema generation to bindings.py; clean up for linting
Diffstat (limited to 'src/services/api')
-rw-r--r-- | src/services/api/graphql/bindings.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/services/api/graphql/bindings.py b/src/services/api/graphql/bindings.py new file mode 100644 index 000000000..1403841b4 --- /dev/null +++ b/src/services/api/graphql/bindings.py @@ -0,0 +1,14 @@ +import vyos.defaults +from . graphql.mutations import mutation +from . graphql.directives import DataDirective + +from ariadne import make_executable_schema, load_schema_from_path, snake_case_fallback_resolvers + +def generate_schema(): + api_schema_dir = vyos.defaults.directories['api_schema'] + + type_defs = load_schema_from_path(api_schema_dir) + + schema = make_executable_schema(type_defs, mutation, snake_case_fallback_resolvers, directives={"generate": DataDirective}) + + return schema |