Build API: Implement validate_only calls.
Add validate-only support to all existing endpoints and
tests to enforce the setting is respected.
Add is_in validator to help transition some endpoints
to decorator-only validation.
Some cleanup and standardization in the controller tests.
BUG=chromium:987263
TEST=run_tests
Cq-Depend: chromium:1726252
Change-Id: I108dfc1a221847eae47a18f2f60e12d2575c9ea8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1726253
Reviewed-by: David Burger <dburger@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
diff --git a/api/controller/dependency.py b/api/controller/dependency.py
index 31b2703..cc71795 100644
--- a/api/controller/dependency.py
+++ b/api/controller/dependency.py
@@ -11,6 +11,7 @@
from __future__ import print_function
+from chromite.api import validate
from chromite.lib import portage_util
from chromite.service import dependency
@@ -47,16 +48,17 @@
source_path.path = path
-def GetBuildDependencyGraph(input_proto, output_proto):
+@validate.require('build_target.name')
+@validate.validation_complete
+def GetBuildDependencyGraph(input_proto, output_proto, _config):
"""Create the build dependency graph.
Args:
input_proto (GetBuildDependencyGraphRequest): The input arguments message.
output_proto (GetBuildDependencyGraphResponse): The empty output message.
+ _config (api_config.ApiConfig): The API call config.
"""
board = input_proto.build_target.name
- assert board, 'Missing build target name'
-
json_map = dependency.GetBuildDependency(board)
AugmentDepGraphProtoFromJsonMap(json_map, output_proto.dep_graph)