-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pydantic 1.1 under python 3.8 does not allow custom datatypes with Ge…
…nerics Re-implemented as a functional_validator
- Loading branch information
1 parent
ca85918
commit 2ee3fe2
Showing
5 changed files
with
34 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
from pydantic import Field | ||
from typing import List | ||
|
||
from core.util.flask_util import CustomBaseModel, StrCommaList | ||
from pydantic import Field, validator | ||
|
||
from core.util.flask_util import CustomBaseModel, str_comma_list_validator | ||
|
||
|
||
class QuicksightGenerateUrlRequest(CustomBaseModel): | ||
library_ids: StrCommaList[int] = Field( | ||
library_ids: List[int] = Field( | ||
description="The list of libraries to include in the dataset, an empty list is equivalent to all the libraries the user is allowed to access." | ||
) | ||
|
||
@validator("library_ids", pre=True) | ||
def parse_library_ids(cls, value): | ||
return str_comma_list_validator(value) | ||
|
||
|
||
class QuicksightGenerateUrlResponse(CustomBaseModel): | ||
embed_url: str = Field(description="The dashboard embed url.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters