jamescourtney / FlatSharp

Fast, idiomatic C# implementation of Flatbuffers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support empty table?

shwuhk opened this issue · comments

I created an empty table and the compiler warn me that
FlatSharp.Compiler.targets(28, 5): Message='Can't create table type model from type Package.LoginPayload because it does not have any non-static, non-deprecated [FlatBufferItem] properties.', Scope=$.

Empty table is not supported by FlatSharp or Flatbuffer?

Not supported in Flatsharp. Not sure about FlatBuffers.

What is the use case for an empty table? It doesn't do anything beyond take up 8 bytes in the buffer. The reason FlatSharp treats this as an error is because it's assuming you forgot to put attributes on your properties, but perhaps that's a bad assumption.

When designing our message, there is a payload for every type of message and we expect this payload would exists in every message even the payload is empty. So when we design the MessageService class, we would accept a payload type to decode the message.

I'll take a look at this -- might be a few days since I'm busy with work at the moment.

No worry. Thanks for your help!

Appreciate your help!

Will be released in Version 5.2.0. Preview build is available here: https://ci.appveyor.com/project/jamescourtney/flatsharp/builds/38623593/artifacts

Great! Thanks.
So I can remove the empty field now.