summaryrefslogtreecommitdiff
path: root/src/services/api/graphql/bindings.py
blob: c123f68d81f1c90093801b6fca0c0c135833d61d (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, ConfigFileDirective

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, "configfile": ConfigFileDirective})

    return schema