You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a converter’s first argument has a type annotation, that type will appear in the signature for init. A converter will override an explicit type annotation or type argument.
This is also unfortunate because it disable adding openAPI documentation on attributes 😭
fromtypingimportOptionalfromtyping_extensionsimportAnnotatedfromstac_fastapi.types.searchimportAPIRequest, str2listimportattrfromfastapiimportQuery@attr.sclassBaseSearchGetRequest(APIRequest):
"""Base arguments for GET Request."""collections: Annotated[
Optional[str],
Query(
description="Array of collection Ids to search for items.",
json_extra_schema={
"examples":[
"collection1,collection2",
]
}
),
] =attr.ib(
default=None, converter=str2list
)
BaseSearchGetRequest?
Initsignature: BaseSearchGetRequest(collections: str=None) ->NoneDocstring: BaseargumentsforGETRequest.
Initdocstring: MethodgeneratedbyattrsforclassBaseSearchGetRequest.
Type: typeSubclasses:
Initsignature:
@attr.sclassBaseSearchGetRequest(APIRequest):
"""Base arguments for GET Request."""collections: Annotated[
Optional[str],
Query(
description="Array of collection Ids to search for items.",
json_extra_schema={
"examples":[
"collection1,collection2",
]
}
),
] =attr.ib(
default=None
)
BaseSearchGetRequest?
Initsignature:
BaseSearchGetRequest(
collections: Annotated[Optional[str], Query(PydanticUndefined)] =None,
) ->NoneDocstring: BaseargumentsforGETRequest.
Initdocstring: MethodgeneratedbyattrsforclassBaseSearchGetRequest.
Type: typeSubclasses:
The text was updated successfully, but these errors were encountered:
defcollection_converter(
x: Annotated[
Optional[str],
Query(
description="Array of collection Ids to search for items.",
json_extra_schema={
"examples":[
"collection1,collection2",
]
}
),
]
) ->Optional[List]:
"""Convert string to list base on , delimiter."""ifx:
returnx.split(",")
in #729 and #714 we've tried using dataclass and attrs to define the APIRequest class used as GET Request model (defining QueryParameters)
With #729 we've moved back to
attrs
and successfully were able to usealias
field (likefilter-crs
, #638)While this work great, I've discovered that it won't work when an attribute will have a
converter
:from the
attrs
documentationThis is also unfortunate because it disable adding
openAPI
documentation on attributes 😭The text was updated successfully, but these errors were encountered: