diff --git a/joj3_config_generator/models/repo.py b/joj3_config_generator/models/repo.py index 87734a9..18512dd 100644 --- a/joj3_config_generator/models/repo.py +++ b/joj3_config_generator/models/repo.py @@ -50,8 +50,8 @@ class HealthCheck(StrictBaseModel): required_files: List[str] = Field( [], validation_alias=AliasChoices("required-files", "required_files") ) - whitelisted_chars: List[str] = Field( - [], validation_alias=AliasChoices("whitelisted-chars", "whitelisted_chars") + whitelisted_chars: str = Field( + "", validation_alias=AliasChoices("whitelisted-chars", "whitelisted_chars") ) @field_validator("max_size", mode="before") @@ -63,12 +63,8 @@ class HealthCheck(StrictBaseModel): @field_validator("whitelisted_chars") @classmethod - def ensure_non_ascii_single_char_list(cls, chars: List[str]) -> List[str]: + def ensure_non_ascii_chars(cls, chars: str) -> str: for c in chars: - if len(c) != 1: - raise ValueError( - "Each whitelisted character must be exactly one character" - ) if c.isascii(): raise ValueError( "Each whitelisted character must be a non-ASCII character" diff --git a/joj3_config_generator/transformers/repo.py b/joj3_config_generator/transformers/repo.py index d5749fc..82f0f93 100644 --- a/joj3_config_generator/transformers/repo.py +++ b/joj3_config_generator/transformers/repo.py @@ -131,7 +131,7 @@ def get_health_check_args(repo_conf: repo.Config) -> List[str]: ] if repo_conf.health_check.whitelisted_chars: args.append( - f"-whitelistedChars={','.join(repo_conf.health_check.whitelisted_chars)}" + f"-whitelistedChars={','.join(list(repo_conf.health_check.whitelisted_chars))}" ) args.extend( [ diff --git a/tests/convert/whitelisted-chars/repo.toml b/tests/convert/whitelisted-chars/repo.toml index b62e42b..bd66ab0 100644 --- a/tests/convert/whitelisted-chars/repo.toml +++ b/tests/convert/whitelisted-chars/repo.toml @@ -1 +1 @@ -health-check.whitelisted-chars = ["你", "好", "!"] +health-check.whitelisted-chars = "你好!"