arangodb-net-standard icon indicating copy to clipboard operation
arangodb-net-standard copied to clipboard

LinkProperties dictionnary items do not serialize properties correctly, when using PostCreateViewAsync

Open sqnz opened this issue 3 years ago • 1 comments

Hello, I posted this on ArangoDb's slack, channel dotnet.

When I call PostCreateViewAsync with LinksProperties, I noticed that the LinkProperties's collection properties are CamelCase, with an uppercase first letter. ArangoDb expect a lowercase first letter (camelCase), so the collection properties are ignored.

Here is a request I copied-pasted from wireshark to Postman, and execute. You can see that everything is camelCase (lowercase) except the Fields, IncludeAllFields, etc. in my links's Fichiers collection. In the response, you can see that the includeAllFields property is ignored. (I wanted true but it shows false, the default value)

image

This bug is not important because I use a workaround : I am sending the JSON request in a post request on the transport object.

Here is my code to reproduce (replace Project.Dal.Db! by your Db object) :

Dictionary<string, LinkProperties> links = new Dictionary<string, LinkProperties>();
links.Add("Fichiers", new LinkProperties()
{
    IncludeAllFields = true
});

await Project.Dal.Db!.View.PostCreateViewAsync(new ArangoDBNetStandard.ViewApi.Models.ViewDetails()
{
    Name = "VueTest20",
    Type = "arangosearch",
    Links = links
});

By the way, if it's hard to fix the serialization, we could do a workaround and document this in the readme. I read that we can provide our own json serialization in the readme, however I don't understand how to do it... maybe we could add an example in the readme.

Thanks!

sqnz avatar Jul 27 '22 01:07 sqnz

@sqnz Thank you for reporting this bug. Dictionary item values are being serialized by DictionaryValueConverter.WriteJson() which uses a local JsonSerializer that is "unaware" of all the serialization options that are being used. I am working on a solution to fix this.

tjoubert avatar Jul 27 '22 09:07 tjoubert

@tjoubert I have reopened because the new serialization option isn't applied in PostCreateViewAsync. I think we should apply it in order to fix the issue. Can you confirm?

I've also left some review comments on the pull request. https://github.com/ArangoDB-Community/arangodb-net-standard/pull/401#pullrequestreview-1197297375

DiscoPYF avatar Nov 29 '22 10:11 DiscoPYF