diff --git a/src/gallia/command/config.py b/src/gallia/command/config.py index c293ad6c7..fd1643edf 100644 --- a/src/gallia/command/config.py +++ b/src/gallia/command/config.py @@ -19,7 +19,7 @@ get_args, ) -from pydantic import BeforeValidator +from pydantic import BeforeValidator, PlainSerializer from pydantic.fields import _FromFieldInfoInputs from pydantic_core import PydanticUndefined @@ -65,6 +65,7 @@ def err_int(x: str, base: int) -> int: HexBytes = Annotated[ bytes, BeforeValidator(lambda x: x if isinstance(x, bytes) else binascii.unhexlify(x)), + PlainSerializer(lambda x: binascii.hexlify(x)), ] """ Special type for a field, which parses bytes from hex strings.