How to verify the data runtime using .fbs file instead of using generated class

96 views
Skip to first unread message

Li yonggang

unread,
Nov 28, 2016, 3:18:15 AM11/28/16
to FlatBuffers
Currently we can use generated class to verify the user's input flatbuffer data, but how can I runtime verify the flatbuffer data given the .fbs file w/o compile the generated class?

mikkelfj

unread,
Nov 28, 2016, 5:07:31 PM11/28/16
to FlatBuffers


On Monday, November 28, 2016 at 9:18:15 AM UTC+1, Li yonggang wrote:
Currently we can use generated class to verify the user's input flatbuffer data, but how can I runtime verify the flatbuffer data given the .fbs file w/o compile the generated class?

I don't think that you can. Theoretically you could do it with binary schema (.bfbs), but I am not aware of an existing implementation that can do this.

Li yonggang

unread,
Nov 28, 2016, 7:05:36 PM11/28/16
to FlatBuffers
Thanks mikkelfj. do we know any plan from google's flatbuffer team to implement this kind of feature?

Wouter van Oortmerssen

unread,
Nov 28, 2016, 7:17:32 PM11/28/16
to Li yonggang, FlatBuffers
Yes, implementing it using binary schemas would probably be best.

We have no plans to implement this ourselves at the moment, but would welcome a PR.

--
You received this message because you are subscribed to the Google Groups "FlatBuffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zarian Waheed

unread,
Dec 1, 2016, 6:59:38 AM12/1/16
to FlatBuffers, leey...@gmail.com
Hi,

I was working on the exact same thing for my database project JonoonDB. I was doing it outside of flatbuffers in my own project. You can take a look at it here:

https://github.com/zarianw/jonoondb/blob/zw_bug_fixes/src/jonoondb_api/flatbuffers_document.cc#L330

It uses reflection and verifier for doing almost all verification. The verification code is still in progress. Once I have the code complete and tested, I can create a PR for flatbuffers. Most of it should carry over as is since it is using existing flatbuffers functionality. Expect a PR over the weekend. In the meanwhile if anyone wants to peek at it and provide guidance/feedback that would be great.

Thanks,
Zarian.
To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers...@googlegroups.com.

Wouter van Oortmerssen

unread,
Dec 2, 2016, 1:46:46 PM12/2/16
to Zarian Waheed, FlatBuffers, Li yonggang
Zarian: nice! Code appears to look good, please make a PR. Maybe add it to reflection.cpp.

To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers+unsubscribe@googlegroups.com.

Zarian Waheed

unread,
Dec 6, 2016, 4:54:18 AM12/6/16
to FlatBuffers, zarian...@gmail.com, leey...@gmail.com

Wouter van Oortmerssen

unread,
Dec 7, 2016, 6:24:59 PM12/7/16
to Zarian Waheed, FlatBuffers, Li yonggang
Appreciated! Some small comments.

To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages