Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sqnz opened this issue Jul 27, 2022 · 2 comments · Fixed by #401 or #445
Assignees

Comments

@sqnz
Copy link

sqnz commented Jul 27, 2022

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!

@tjoubert tjoubert self-assigned this Jul 27, 2022
@tjoubert
Copy link
Contributor

@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.

@DiscoPYF
Copy link
Collaborator

@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. #401 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants