-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
21 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from mashumaro.core.meta.helpers import get_type_origin | ||
|
||
from openapify.core.models import TypeAnnotation | ||
|
||
|
||
def get_value_type(value_type: TypeAnnotation) -> TypeAnnotation: | ||
super_type = getattr(value_type, "__supertype__", None) | ||
if super_type is not None: | ||
return get_value_type(super_type) | ||
origin_type = get_type_origin(value_type) | ||
if origin_type is not value_type: | ||
return get_value_type(origin_type) | ||
return value_type |