[beta 8.0.0] plaid_api.LinkTokenCreateRequest doesn't like string parameters
jleclanche opened this issue · 6 comments
Various examples:
# with country_codes=["US"]
plaid.exceptions.ApiTypeError: Invalid type for variable '0'. Required value type is CountryCode and passed type was str at ['country_codes'][0]
# with products=["auth", "identity"]
plaid.exceptions.ApiTypeError: Invalid type for variable '0'. Required value type is Products and passed type was str at ['products'][0]
Super verbose for no good reason, no?
Documentation on this is also failing as it shows using strings not models.
fyi @stephenjayakar -- is this intended behavior?
@jleclanche we changed these values to be ENUMS to restrict the different values that are allowed in these functions.
We will add this to the migration guide when we remove the beta tag. Thanks for the feedback.
@cgfarmer4 Thanks. Make sure you update the web documentation; right now it's not showing enums usage or imports correctly.
My personal recommendation is that if you do want to go this route, you do at least one the following:
- Add typings to the methods that accept those enums so that mypy / pylance can pick up the type errors
- Attempt to values to enums and such, so that
country_codes=["US"]
does work, because it's a valid value.
If the client is updated to openapi-generator 6.2.0 then this should work better.
For example with an inline enum op definition, models allow a string to be passed in for the enum or an instance of the enum class:
https://github.com/OpenAPITools/openapi-generator/blob/master/samples/openapi3/client/petstore/python/petstore_api/model/json_patch_request_add_replace_test.py#L111
def __new__(
cls,
*args: typing.Union[dict, frozendict.frozendict, ],
op: typing.Union[MetaOapg.properties.op, str, ],
path: typing.Union[MetaOapg.properties.path, str, ],
value: typing.Union[MetaOapg.properties.value, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ],
_configuration: typing.Optional[schemas.Configuration] = None,
) -> 'JSONPatchRequestAddReplaceTest':
return super().__new__(
cls,
*args,
op=op,
path=path,
value=value,
_configuration=_configuration,
)
@spacether thanks for the heads up. I've talked with the team and based on this feedback we've added updating to the latest openapi generator version to our roadmap, most likely sometime in the next 9 months.
Nice, thank you for sharing that. For now referenced components are only seen as the imported class type. So if the enum stays as a component, then the type hint will be to the imported component class and won't include that import's primitive python type.