summaryrefslogtreecommitdiff
path: root/src/services/api/graphql/bindings.py
blob: 1403841b40578c83b6fd383f5a9f5d7b99ec6096 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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