#49 deserialize $vector -> $binary#123
Conversation
… for DataAPIVector given serialization options available.
|
For clarity, could we not have |
@toptobes we could if $binary is only ever used (by other clients and cql) when inside the $vector structure. I thought that float arrays as a whole could be serialized/deserialized as $binary. The current structure allows the user to control that if desired, but also handles being able to deserialize any float array from $binary structure. |
That's fair. So to be certain, if you don't provide an explicit type, and it's a vector field (whether by And if you wanted to override it manually you do something like this, or am I misunderstanding? [JsonConverter(typeof(FloatArrayWriter))]
[DocumentMapping(DocumentMappingField.Vector)]
public float[] Vector { get; set; } |
Yep. |
I'm not sure I fully grasp the resolution of this thread, but in case it's relevant: python client and curl at least do support $binary outside of $vector: https://docs.datastax.com/en/astra-db-serverless/api-reference/document-methods/insert-one.html |
# Conflicts: # test/DataStax.AstraDB.DataApi.IntegrationTests/TestObjects.cs
|
I am afraid there is a regression in the form of plain lists of floats (not 'vectors') being serialized as $binary. This is something the Data API does not accept. Observed and reproduced with the latest commit ( Suggestion: if not present, add a similar test that uses typed collections and a |
Completes Pre-GA portion of #49 (and #67). Also might eliminate need for DataAPIVector given serialization options available.
$binary is properly deserialized for float[] properties
User can control how float arrays are serialized via attributes on the properties:
Fixes #49 .