ctaggart / froto

Froto: F# Protocol Buffers
MIT License
146 stars 27 forks source link

PulsarApi.proto #106

Closed vilinski closed 3 years ago

vilinski commented 5 years ago

Getting error with the file PulsarApi.proto:

falanx --inputfile PulsarApi.proto --outputfile Pulsar.Proto.fs --defaultnamespace Pulsar.Proto --serializer binary
Generating code for: PulsarApi.proto
ERROR: proto file was not able to be parsed.

Error in Ln: 55 Col: 11
    optional int32 partition = 3;
          ^
Expecting: whitespace

Looks nothing suspect for me on this place:

message MessageIdData {
    required uint64 ledgerId = 1;
    required uint64 entryId  = 2;
    optional int32 partition = 3 [default = -1];
    optional int32 batch_index = 4 [default = -1];
}
jhugard commented 5 years ago

Haven't worked this code in forever, but I think the root cause has to do with the core parsing for messages: something was consuming a token and leaving the parser in a bad state.

Can you try PR #107?

jhugard commented 3 years ago

@vilinski The commit above was included in release 0.7.2. Can you verify the change worked, so that this issue can be closed?

vilinski commented 3 years ago

sorry, waited for falanx updates it's deps.

Falanx 0.6.0 still doesn't work with actual PulsarApi.proto with the parser bug on the same line.

❯ falanx --inputfile PulsarApi.proto --outputfile Pulsar.Proto.fs --defaultnamespace Pulsar.Proto --serializer binary

Generating code for: PulsarApi.proto
ERROR: proto file was not able to be parsed.

Error in Ln: 60 Col: 12
     optional int32 partition = 3 [default = -1];
           ^
Expecting: whitespace

But type provider works without errors.

#r "nuget: Froto.TypeProvider"

open Froto.TypeProvider

let [<Literal>] PulsarApiProto = __SOURCE_DIRECTORY__ + "/PulsarApi.proto"
type PulsarApi = ProtocolBuffersTypeProvider<PulsarApiProto>

let msg = PulsarApi.Pulsar.Proto.MessageIdData()
msg.Partition <- Some 42

so not a Froto issue anymore. Rather falanx still does not include the changes (09.04.2020)