summaryrefslogtreecommitdiff
path: root/src/services/vyos-http-api-server
diff options
context:
space:
mode:
Diffstat (limited to 'src/services/vyos-http-api-server')
-rwxr-xr-xsrc/services/vyos-http-api-server10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server
index acaa383b4..89c685f32 100755
--- a/src/services/vyos-http-api-server
+++ b/src/services/vyos-http-api-server
@@ -96,9 +96,10 @@ class BaseConfigureModel(BaseModel):
path: List[StrictStr]
value: StrictStr = None
- @validator("path", pre=True, always=True)
+ @validator("path")
def check_non_empty(cls, path):
- assert len(path) > 0
+ if not len(path) > 0:
+ raise ValueError('path must be non-empty')
return path
class ConfigureModel(ApiModel):
@@ -106,9 +107,10 @@ class ConfigureModel(ApiModel):
path: List[StrictStr]
value: StrictStr = None
- @validator("path", pre=True, always=True)
+ @validator("path")
def check_non_empty(cls, path):
- assert len(path) > 0
+ if not len(path) > 0:
+ raise ValueError('path must be non-empty')
return path
class Config: