File size: 300 Bytes
2f07364
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from pydantic import BaseModel, validator


class Language(BaseModel):
    sourceLanguage: str

    @validator('sourceLanguage', pre=True)
    def blank_string_in_language(cls, value, field):
        if value == "":
            raise ValueError('sourceLanguage cannot be empty')
        return value