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/api.py b/api/controller/api.py
index 3a91baa..d3b3220 100644
--- a/api/controller/api.py
+++ b/api/controller/api.py
@@ -8,6 +8,7 @@
 from __future__ import print_function
 
 from chromite.api import router as router_lib
+from chromite.api import validate
 
 # API version number.
 # The major version MUST be updated on breaking changes.
@@ -18,14 +19,16 @@
 VERSION_BUG = 0
 
 
-def GetMethods(_input_proto, output_proto):
+@validate.validation_complete
+def GetMethods(_input_proto, output_proto, _config):
   """List all of the registered methods."""
   router = router_lib.GetRouter()
   for method in router.ListMethods():
     output_proto.methods.add().method = method
 
 
-def GetVersion(_input_proto, output_proto):
+@validate.validation_complete
+def GetVersion(_input_proto, output_proto, _config):
   """Get the Build API major version number."""
   output_proto.version.major = VERSION_MAJOR
   output_proto.version.minor = VERSION_MINOR