summaryrefslogtreecommitdiff
path: root/src/services/api/graphql/utils
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-10-23 11:05:33 -0500
committerJohn Estabrook <jestabro@vyos.io>2022-10-25 09:03:06 -0500
commit093ac258c11894b07afd9e85a61778d23e356718 (patch)
tree48d032a94917826b029143c99a56acc5faffda9f /src/services/api/graphql/utils
parentec82d60828500a56b6fe8357970bf839053ac0af (diff)
downloadvyos-1x-093ac258c11894b07afd9e85a61778d23e356718.tar.gz
vyos-1x-093ac258c11894b07afd9e85a61778d23e356718.zip
graphql: T4574: call all schema definition generation on init
Diffstat (limited to 'src/services/api/graphql/utils')
-rwxr-xr-xsrc/services/api/graphql/utils/schema_from_composite.py8
-rwxr-xr-xsrc/services/api/graphql/utils/schema_from_config_session.py8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/services/api/graphql/utils/schema_from_composite.py b/src/services/api/graphql/utils/schema_from_composite.py
index f9983cd98..d5e0ecdf6 100755
--- a/src/services/api/graphql/utils/schema_from_composite.py
+++ b/src/services/api/graphql/utils/schema_from_composite.py
@@ -23,13 +23,15 @@ import json
from inspect import signature, getmembers, isfunction, isclass, getmro
from jinja2 import Template
+from vyos.defaults import directories
if __package__ is None or __package__ == '':
from util import snake_to_pascal_case, map_type_name
+ from composite_function import queries, mutations
else:
from . util import snake_to_pascal_case, map_type_name
+ from . composite_function import queries, mutations
-# this will be run locally before the build
-SCHEMA_PATH = '../graphql/schema'
+SCHEMA_PATH = directories['api_schema']
schema_data: dict = {'schema_name': '',
'schema_fields': []}
@@ -100,8 +102,6 @@ def create_schema(func_name: str, func: callable, template: str) -> str:
return res
def generate_composite_definitions():
- from composite_function import queries, mutations
-
results = []
for name,func in queries.items():
res = create_schema(name, func, query_template)
diff --git a/src/services/api/graphql/utils/schema_from_config_session.py b/src/services/api/graphql/utils/schema_from_config_session.py
index ea78aaf88..b6609357e 100755
--- a/src/services/api/graphql/utils/schema_from_config_session.py
+++ b/src/services/api/graphql/utils/schema_from_config_session.py
@@ -23,13 +23,15 @@ import json
from inspect import signature, getmembers, isfunction, isclass, getmro
from jinja2 import Template
+from vyos.defaults import directories
if __package__ is None or __package__ == '':
from util import snake_to_pascal_case, map_type_name
+ from config_session_function import queries, mutations
else:
from . util import snake_to_pascal_case, map_type_name
+ from . config_session_function import queries, mutations
-# this will be run locally before the build
-SCHEMA_PATH = '../graphql/schema'
+SCHEMA_PATH = directories['api_schema']
schema_data: dict = {'schema_name': '',
'schema_fields': []}
@@ -100,8 +102,6 @@ def create_schema(func_name: str, func: callable, template: str) -> str:
return res
def generate_config_session_definitions():
- from config_session_function import queries, mutations
-
results = []
for name,func in queries.items():
res = create_schema(name, func, query_template)