jet / falanx

Generates F# code from protobuf schema for binary and json format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enum in class is not working: lead.proto.fs(251, 13): [FS0001] No overloads match for method 'OfJson'.

rstradling opened this issue · comments

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

This seems to be a duplicate (or at least a consequence) of #131
If you read there, a fix was applied to Fleece already.
I'll be publishing a new nuget for Fleece this week, keep tuned in #131