feat(api): OpenAPI spec update via Stainless API (#153)

This commit is contained in:
stainless-app[bot] 2024-03-20 14:50:23 +00:00 committed by stainless-bot
parent 2d5a6ea16c
commit a953222e49

View file

@ -290,11 +290,15 @@ def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericMo
return issubclass(origin, BaseModel) or issubclass(origin, GenericModel)
def construct_type(*, value: object, type_: type) -> object:
def construct_type(*, value: object, type_: object) -> object:
"""Loose coercion to the expected type with construction of nested values.
If the given value does not match the expected type then it is returned as-is.
"""
# we allow `object` as the input type because otherwise, passing things like
# `Literal['value']` will be reported as a type error by type checkers
type_ = cast("type[object]", type_)
# unwrap `Annotated[T, ...]` -> `T`
if is_annotated_type(type_):
meta = get_args(type_)[1:]