You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect that self.username and self.password would be of type str after a call to InitFromObj, but instead it is of type bytes. Examples in the documentation indicate that CreateString always accept a str parameter, so if the Pack function does builder.CreateString(self.username) then the opposite action in UnPack should result in str type for self.username.
Since flatbuffers schema supports string, [byte], and [ubyte] fields, I would expect that the generated Python code also honours that distinction. A library such as jsons (that generates JSON from any Python object) can not know that some fields that have type bytes should be interpreted as strings and others of type bytes are actually bytes.
The following code snippet using the jsons package, allows me to generate JSON data with the expected output types:
Given the following generated Python object api class:
And schema:
I would expect that
self.username
andself.password
would be of typestr
after a call toInitFromObj
, but instead it is of typebytes
. Examples in the documentation indicate thatCreateString
always accept astr
parameter, so if thePack
function doesbuilder.CreateString(self.username)
then the opposite action inUnPack
should result instr
type forself.username
.Since flatbuffers schema supports
string
,[byte]
, and[ubyte]
fields, I would expect that the generated Python code also honours that distinction. A library such asjsons
(that generates JSON from any Python object) can not know that some fields that have typebytes
should be interpreted as strings and others of typebytes
are actually bytes.The following code snippet using the
jsons
package, allows me to generate JSON data with the expected output types:The text was updated successfully, but these errors were encountered: