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 return ESCExecution.RC_ERROR
else: else:
var argument_descriptor = command_object.configure() var argument_descriptor = command_object.configure()
if command_object.validate(self.parameters):
var prepared_arguments = argument_descriptor.prepare_arguments( var prepared_arguments = argument_descriptor.prepare_arguments(
self.parameters self.parameters
) )
if argument_descriptor.validate(self.name, prepared_arguments) and\
command_object.validate(prepared_arguments):
escoria.logger.debug("Running command %s with parameters %s" % [ escoria.logger.debug("Running command %s with parameters %s" % [
self.name, self.name,
prepared_arguments 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()): for index in range(arguments.size()):
if arguments[index] == null: if arguments[index] == null:
# No type checking for null values # No type checking for null values