I have created property Tags (array of strings) in schema. json:
{
“name”:“tags”,
“properties”:{
“isRequired”:false,
“isRequiredOnPublish”:false,
“isHalfWidth”:false,
“fieldType”:“Tags”,
“editor”:“Tags”,
“label”:“Tags”,
“hints”:“Producteigenschap tags.”
},
“isLocked”:false,
“isHidden”:false,
“isDisabled”:false,
“partitioning”:“invariant”
}
and used this property in content. figured out that after I cleanup property value in content after fist “save” squidex put empty object (incorrect value) into “tags” value, if I click “save” second time - it will put null (correct value). empty object lead our system to throw exception, because we expected string array or null on backend, but not an empty object.
I’m submitting a…
Current behavior
tags property equal empty object after cleanup and first content save, and equal null after second (and next) content save
Expected behavior
tags property equal null after it was cleanup an saved
Minimal reproduction of the problem
repro steps:
Environment
Browser:
It could be solved better, that is for sure, but it is not a bug that I am worried about. Null and undefined are treated identical in the backend. There is no differentiation.
Hi Sebastian, thanks for quick reaction. agreed, its not a critical issue, but it will be a problem when you expected string[] or null on backend, but got new object() (c#) and will got serialization exception
But this is not the case. In your video i see the following structures
tags: {
iv: null
}
OR
tags: {
iv: ["tag1"]
}
OR
tags: {
}
in C# any many other programming languages it should not be a problem. I am not sure if this is a problem for the C# SDK to be honest, I can have a look at it. But I don’t see that an array is suddenly an object. It is either the value, null
or undefined
.
EDIT: I just had a look to the tests: It should not be a problem with the C# Client Library (SDK): https://github.com/Squidex/squidex-samples/blob/master/csharp/Squidex.ClientLibrary/Squidex.ClientLibrary.Tests/SerializationTests.cs#L170
find out that its a bug in InvariantConverter (in Squidex.ClientLibrary/InvariantConverter.cs). simple fix for this case:
But where do you have this example in your video? I don’t see it.
It must be
tags: null
I recorded this video this morning on our cloud squidex account: https://cloud.squidex.io/
Yes, but where do you have this null example?