fix: properly validate min_args and remove superfluous validation call to argument descriptor

This commit is contained in:
Duncan Brown
2022-04-09 10:28:41 -04:00
committed by Julian Murgia
parent 7a46908569
commit 157c2f564c
2 changed files with 8 additions and 5 deletions

View File

@@ -117,11 +117,10 @@ func run() -> int:
return ESCExecution.RC_ERROR
else:
var argument_descriptor = command_object.configure()
var prepared_arguments = argument_descriptor.prepare_arguments(
self.parameters
)
if argument_descriptor.validate(self.name, prepared_arguments) and\
command_object.validate(prepared_arguments):
if command_object.validate(self.parameters):
var prepared_arguments = argument_descriptor.prepare_arguments(
self.parameters
)
escoria.logger.debug("Running command %s with parameters %s" % [
self.name,
prepared_arguments

View File

@@ -72,6 +72,10 @@ func validate(command: String, arguments: Array) -> bool:
]
)
# We also validate the arguments as they'll appear being passed in to the
# command in question, including any default values.
arguments = self.prepare_arguments(arguments)
for index in range(arguments.size()):
if arguments[index] == null:
# No type checking for null values