Add validate_generate_args method
Improve argument validation Change-Id: I3dade53263ed3405d1f2a195749140ba3d74c2f1 Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
This commit is contained in:
@@ -154,6 +154,18 @@ class OpenStackServerSourceBase:
|
||||
def generate(self, target_dir, args) -> Path:
|
||||
pass
|
||||
|
||||
def _validate_generate_args(self, target_dir, args):
|
||||
"""Validate common arguments for generate() methods."""
|
||||
if target_dir is None:
|
||||
raise RuntimeError("Missing required argument: target_dir")
|
||||
if args is None:
|
||||
raise RuntimeError("Missing required argument: args")
|
||||
if not hasattr(args, "validate"):
|
||||
raise RuntimeError("Missing required args attribute: validate")
|
||||
if not hasattr(args, "service_type"):
|
||||
raise RuntimeError("Missing required args attribute: service_type")
|
||||
return Path(target_dir)
|
||||
|
||||
def load_openapi(self, path):
|
||||
"""Load existing OpenAPI spec from the file"""
|
||||
if not path.exists():
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ test = [
|
||||
# pip is necessary since siblings installation job uses it
|
||||
"pip", # Apache-2.0
|
||||
"flake8-import-order~=0.19.2", # LGPLv3
|
||||
"stestr>=1.0.0" # Apache-2.0]
|
||||
"stestr>=1.0.0", # Apache-2.0
|
||||
]
|
||||
block-storage = ["cinder>=23.0"]
|
||||
compute = ["nova>=28.0"]
|
||||
|
||||
Reference in New Issue
Block a user