Skip to content

Commit

Permalink
Bugfixes on Python code generation (#152)
Browse files Browse the repository at this point in the history
* Fix raising of validation error

* Fix inverse logic of 'unique' validator
  • Loading branch information
agonzat authored Oct 11, 2023
1 parent 487e7da commit bcb7615
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_func_signature(self, function_name: str, base_type: str) -> str:

@typechecked
def initialization_fail_validation(self, param_name: str) -> str:
return f"raise InvalidParameterValueException('Invalid value set during initialization for parameter {param_name}: ' + validation_result)"
return f"raise InvalidParameterValueException('{param_name}',param.value, 'Invalid value set during initialization for parameter {param_name}: ' + validation_result)"

@typechecked
def initialization_pass_validation(self, param_name: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def one_of(param, values):

# Array validators
def unique(param):
if not len(set(param.value)) != len(param.value):
if len(set(param.value)) != len(param.value):
return f"Parameter '{param.name}' must only contain unique values"
return ""

Expand Down

0 comments on commit bcb7615

Please sign in to comment.