When reading a http response from a SCIM endpoint returning a ListResponse this is not really useful, as pydantic cannot guess by itself which Resource type is returned.
Fortunately, pydantic implements discriminated unions to solve this issue.
With a correctly crafted discriminator, pydantic should be able to read the schemas attribute in the resource payload to guess which model to instantiate.
Currently
ListResponse.Resources
is aList
of the very genericBaseModel
.https://github.com/chalk-ai/pydantic-scim/blob/2f602a1cd282bbd6328e0b92613b01d5ae934753/pydanticscim/responses.py#L44-L49
When reading a http response from a SCIM endpoint returning a
ListResponse
this is not really useful, as pydantic cannot guess by itself whichResource
type is returned. Fortunately, pydantic implements discriminated unions to solve this issue. With a correctly crafted discriminator, pydantic should be able to read theschemas
attribute in the resource payload to guess which model to instantiate.What do you think?