18 from typing
import Optional, Tuple, List, Generic
19 from abc
import abstractmethod
21 from .base_parameter
import BaseParameter, T
24 class BaseListParameter(BaseParameter[T], Generic[T]):
27 def types(self) -> List[type]:
32 def listTypes(self) -> List[type]:
35 def validate(self) -> Tuple[bool, Optional[str]]:
36 isValid, error = super().validate()
40 if not self.required
and self.value
is None:
43 if self.required
and len(self.value) == 0:
44 return False, f
"Required parameter \"{self.name}\" must contain a non-empty array"
48 for element
in self.value:
52 if isinstance(element, bool)
and int
in self.listTypes
and not bool
in self.listTypes:
55 if not any(isinstance(element, type_)
for type_
in self.listTypes):