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
Describe the bug
V2 batch operation update( )cannot post attributes when using custom pydantic object (For example inherited from the ContextEntity/ContextEntityKeyValues)
To Fix
Add SerializeAsAny annotation to the entities. Otherwise update.model_dump() will only serialize the object based on the schema, i.e., the ContextEntity or ContextEntityKeyValues. Therefore, only predefined attribute will be serialized, such as id and type.
classUpdate(BaseModel):
""" Model for update action """action_type: Union[ActionType, str] =Field(
alias="actionType",
description="actionType, to specify the kind of update action to do: ""either append, appendStrict, update, delete, or replace. ",
)
entities: SerializeAsAny[List[Union[ContextEntity, ContextEntityKeyValues]]] =Field(
description="an array of entities, each entity specified using the ""JSON entity representation format "
)
The text was updated successfully, but these errors were encountered:
Describe the bug
V2 batch operation
update( )
cannot post attributes when using custom pydantic object (For example inherited from the ContextEntity/ContextEntityKeyValues)To Fix
Add
SerializeAsAny
annotation to the entities. Otherwise update.model_dump() will only serialize the object based on the schema, i.e., the ContextEntity or ContextEntityKeyValues. Therefore, only predefined attribute will be serialized, such as id and type.The text was updated successfully, but these errors were encountered: