Enable dynamic complex property without @odata.type
@xuzhg is already working on this.
Since Apr 11, 2023.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
Assemblies affected
Which assemblies and versions are known to be affected e.g. ASP.NET Core OData 8.x
Reproduce steps
Consider the following json request payload, the type of 'condition' is an open type, and it accepts dynamic properties.
where, StringEqualsIgnoreCase is dynamic complex type property
{
"condition": {
"StringEqualsIgnoreCase": {
"awsTag":[
"finance",
"hr",
"legal"
]
},
"key1": "value1",
"key2": [
"value2",
"value3"
],
"key3": "value4"
}
}
The above payload can't pass deserialization because there's no type for
a) StringEqualsIgnoreCase
b) awsTag
C) key2
We have to let customer provide types as below, then it can work.
{
"condition": {
"StringEqualsIgnoreCase": {
"@odata.type":"microsoft.graph.awsCondition",
"awsTag@odata.type":"Collection(Edm.String)",
"awsTag":[
"finance",
"hr",
"legal"
]
},
"key1": "value1",
"key2@odata.type": "Collection(Edm.String)",
"key2": [
"value2",
"value3"
],
"key3": "value4"
}
}
Expected behavior
Actually, we don't need customers to provide the types since they are dynamic properties.
Additional context
We can deserialize 'StringEqualsIgnoreCase' as an instance of 'ODataObject', where 'ODataObject' can be defined as:
public class ODataObject: Dictionary<string, object>
{}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.