Skip to content

Commit f176b6e

Browse files
committed
Remove unused get_branch import and set default branch in validate_graphql function
1 parent fc1692b commit f176b6e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

infrahub_sdk/ctl/validate.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from ..ctl.exceptions import QueryNotFoundError
1515
from ..ctl.utils import catch_exception, find_graphql_query, parse_cli_vars
1616
from ..exceptions import GraphQLError
17-
from ..utils import get_branch, write_to_file
17+
from ..utils import write_to_file
1818
from ..yaml import SchemaFile
1919
from .parameters import CONFIG_PARAM
2020
from .utils import load_yamlfile_from_disk_and_exit
@@ -68,8 +68,6 @@ def validate_graphql(
6868
) -> None:
6969
"""Validate the format of a GraphQL Query stored locally by executing it on a remote GraphQL endpoint"""
7070

71-
branch = get_branch(branch)
72-
7371
try:
7472
query_str = find_graphql_query(query)
7573
except QueryNotFoundError:
@@ -81,6 +79,10 @@ def validate_graphql(
8179
variables_dict = parse_cli_vars(variables)
8280

8381
client = initialize_client_sync()
82+
83+
if not branch:
84+
branch = client.config.default_infrahub_branch
85+
8486
try:
8587
response = client.execute_graphql(
8688
query=query_str,

0 commit comments

Comments
 (0)