Arshia001 / FSharp.GrpcCodeGenerator

A protoc plugin to enable generation of F# code + supporting libraries
MIT License
81 stars 9 forks source link

How is a repeated field initialized on a send request? #22

Open awaynemd opened 1 year ago

awaynemd commented 1 year ago

I have tried the following - and all permutations - without success

message Rectangle { int32 X = 1; int32 Y = 2; int32 Width = 3; int32 Height =4; } message Word { google.protobuf.Int32Value VocabularyId = 1; bytes Strokes = 2; string Text = 3; string Confidence = 4; Rectangle BoundingBox =5; }

message SaveVocabularyRequest { repeated Word Words =1 ; }

This fails:

let h = words |> Seq.map InkWordToWord |> Seq.toList

{ Protocol.ProtoBuf.SaveVocabularyRequest.empty() with Words = { Words = {h}} }

Error Message: No Assignment given for field '_UnknownFields' of type 'Protocol.ProtoBuf.SaveVocabularyRequest

Thank you.

marner2 commented 1 year ago

The line below doesn't look right:

{ Protocol.ProtoBuf.SaveVocabularyRequest.empty() with Words = { Words = {h}} }

Don't you mean something like the following:

let wordsFields = RepeatedField()
wordsFields.AddRepeated(h)
{ Protocol.ProtoBuf.SaveVocabularyRequest.empty() with Words = wordsFields }