Enum in class is not working: lead.proto.fs(251, 13): [FS0001] No overloads match for method 'OfJson'.
rstradling opened this issue · comments
Ryan Stradling commented
Snippet like the below
enum SourceEnum {
FACEBOOK = 0;
OTHER = 1;
}
message Source {
/* Only used if the source_type = OTHER */
string other = 1;
SourceEnum source = 2;
}
generates code
[<CLIMutable>]
type Source =
{ mutable other : string option
mutable source : SourceEnum option }
static member JsonObjCodec =
(fun other source ->
{ other = other
source = source }) <!> Operators.jopt<Source, String> ("other") (fun x -> x.other)
<*> Operators.jopt<Source, SourceEnum> ("source") (fun x -> x.source)
which generates error
lead.proto.fs(251, 13): [FS0001] No overloads match for method 'OfJson'. The available overloads are shown below.
Which seems to be referring to this line
<*> Operators.jopt<Source, SourceEnum> ("source") (fun x -> x.source)
as the problem
Gustavo Leon commented