|
3 | 3 |
|
4 | 4 | from mavedb.lib.validation import keywords |
5 | 5 | from mavedb.lib.validation.exceptions import ValidationError |
| 6 | +from mavedb.lib.validation.utilities import is_null |
6 | 7 | from mavedb.view_models import PublicationIdentifiersGetter |
7 | 8 | from mavedb.view_models.base.base import BaseModel, validator |
8 | 9 | from mavedb.view_models.doi_identifier import ( |
@@ -72,6 +73,30 @@ def validate_keywords(cls, v): |
72 | 73 | keywords.validate_keywords(v) |
73 | 74 | return v |
74 | 75 |
|
| 76 | + @validator("title") |
| 77 | + def validate_title(cls, v): |
| 78 | + if is_null(v) or not isinstance(v, str): |
| 79 | + raise ValidationError("Invalid title. Title should not be None or space.") |
| 80 | + return v |
| 81 | + |
| 82 | + @validator("short_description") |
| 83 | + def validate_short_description(cls, v): |
| 84 | + if is_null(v) or not isinstance(v, str): |
| 85 | + raise ValidationError("Invalid short description. Short description should not be None or space.") |
| 86 | + return v |
| 87 | + |
| 88 | + @validator("abstract_text") |
| 89 | + def validate_abstract_text(cls, v): |
| 90 | + if is_null(v) or not isinstance(v, str): |
| 91 | + raise ValidationError("Invalid abstract text. Abstract text should not be None or space.") |
| 92 | + return v |
| 93 | + |
| 94 | + @validator("method_text") |
| 95 | + def validate_method_text(cls, v): |
| 96 | + if is_null(v) or not isinstance(v, str): |
| 97 | + raise ValidationError("Invalid method text. Method text should not be None or space.") |
| 98 | + return v |
| 99 | + |
75 | 100 |
|
76 | 101 | class ExperimentCreate(ExperimentModify): |
77 | 102 | experiment_set_urn: Optional[str] |
|
0 commit comments