Replies: 2 comments 1 reply
-
@xuzhg hi, sorry for linking you directly, i hope its not a problem. Do you have any idea if there is a configuration for this? i cant find anything in the documentation |
Beta Was this translation helpful? Give feedback.
0 replies
-
@tulio84z I'm not sure if you can change that without overriding the serializer. I think this question is similar to this one: #274 which provides an example of customizing the serializer. @xuzhg I think we need better documentation for customizing the serializer (here's some doc from Web Api 7: https://learn.microsoft.com/en-us/odata/webapi/customize-formatter) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After making all our endpoint odata compliant, all endpoints that have enums as a returned model, now are returning a string representation of the enum instead of the value of the enum. In our case, all our enums are declared as byte.
For example we have an enum that is declared as
public enum MyEnum : byte{
EnumA = 1,
EnumB = 2,
EnumC = 3
}
//Then in the model returned by our api:
public class MyModel {
public string Name {get; set;}
public Enums.MyEnum MyEnum {get; set;}
}
//Now, before making the endpoints OData compliant, our /MyModel endpoint would return:
{
"name": "mymodel1",
"myEnum": 1
}
//Now, after making the endpoints OData compliant, our /MyModel endpoint is returning:
{
"name": "mymodel1",
"myEnum": "EnumA"
}
My question is: is there any configuration to disable this behavior?
Any help is much appreciated.
Regards,
mtz
Beta Was this translation helpful? Give feedback.
All reactions