diff options
author | John Estabrook <jestabro@vyos.io> | 2022-10-23 11:05:33 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2022-10-25 09:03:06 -0500 |
commit | 093ac258c11894b07afd9e85a61778d23e356718 (patch) | |
tree | 48d032a94917826b029143c99a56acc5faffda9f /src/services/api/graphql/utils | |
parent | ec82d60828500a56b6fe8357970bf839053ac0af (diff) | |
download | vyos-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-x | src/services/api/graphql/utils/schema_from_composite.py | 8 | ||||
-rwxr-xr-x | src/services/api/graphql/utils/schema_from_config_session.py | 8 |
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) |