Skip to content

Commit 167c10e

Browse files
fix(host): Add validation to ensure remark is not empty in CreateHost
1 parent 3d52137 commit 167c10e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/models/host.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ def address_str(self) -> str:
251251
class CreateHost(BaseHost):
252252
@field_validator("remark", mode="after")
253253
def validate_remark(cls, v):
254+
if not v:
255+
raise ValueError("Remark cannot be empty")
254256
try:
255257
v.format_map(FormatVariables())
256258
except ValueError:

0 commit comments

Comments
 (0)