diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5c8e366f..ed2f3277 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ Brewtils Changelog ------ TBD +- Fixed bug where parameter type mapping did not match type hinting - Exposed a read only feature to provide the current request that is being processed `from brewtils import get_current_request_read_only` - Expand Job Export to include Job id diff --git a/brewtils/decorators.py b/brewtils/decorators.py index b27019be..7186aaa5 100644 --- a/brewtils/decorators.py +++ b/brewtils/decorators.py @@ -297,19 +297,20 @@ def echo(self, message): """ # Validate type against permitted string literals - if not isinstance(type, str): - # Try to map literal to string equivalent - temp_type = _format_type(type) - if temp_type in Parameter.TYPES: - type = temp_type - elif type not in Parameter.TYPES: - # Allowing type matching: string == String == STRING - for parameter_type in Parameter.TYPES: - if type.upper() == parameter_type.upper(): - type = parameter_type - break - if type not in Parameter.TYPES: - raise ValueError(f"Unable to map type {type} to string literal") + if type: + if not isinstance(type, str): + # Try to map literal to string equivalent + temp_type = _format_type(type) + if temp_type in Parameter.TYPES: + type = temp_type + elif type not in Parameter.TYPES: + # Allowing type matching: string == String == STRING + for parameter_type in Parameter.TYPES: + if type.upper() == parameter_type.upper(): + type = parameter_type + break + if type not in Parameter.TYPES: + raise ValueError(f"Unable to map type {type} to string literal") if _wrapped is None: return functools.partial( diff --git a/test/decorators_test.py b/test/decorators_test.py index 7ab81dca..c7e4ad78 100644 --- a/test/decorators_test.py +++ b/test/decorators_test.py @@ -731,7 +731,7 @@ def cmd6(foo): assert cmd3.parameters[0].type == "Float" assert cmd4.parameters[0].type == "Boolean" assert cmd5.parameters[0].type == "Dictionary" - assert cmd6.parameters[0].type == "Any" + assert cmd6.parameters[0].type is None with pytest.raises(ValueError):