[C#][23.3.3] flatc doesn't generate Verify class for unions
fefe-mercurio-teaching opened this issue · comments
Federico Mercurio (Teaching) commented
Schema:
table StringType {
value: string;
}
table IntType {
value: int;
}
table SingleType {
value: float;
}
table BoolType {
value: bool;
}
union BaseType { StringType, IntType, SingleType, BoolType }
table ScriptCallParam {
name: string;
value: BaseType;
}
Generated BaseType.cs:
public enum BaseType : byte
{
NONE = 0,
StringType = 1,
IntType = 2,
SingleType = 3,
BoolType = 4,
};
Issue on ScriptCallParam.cs: BaseTypeVerify doesn't exist
[...]
static public class ScriptCallParamVerify
{
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
{
return verifier.VerifyTableStart(tablePos)
&& verifier.VerifyString(tablePos, 4 /*Name*/, false)
&& verifier.VerifyField(tablePos, 6 /*ValueType*/, 1 /*BaseType*/, 1, false)
&& verifier.VerifyUnion(tablePos, 6, 8 /*Value*/, BaseTypeVerify.Verify, false)
&& verifier.VerifyTableEnd(tablePos);
}
}
Jason Jackson commented
I am seeing this as well.. To get around it for now I just removed the && VerifyUnion().
Hunter Negron commented
I am also experiencing this, with the same flatc
version. Do you know if this is an issue with previous versions? I might just downgrade.
Jason Jackson commented
Downgrading became an issue because the version gets put into the generated .cs files.
rodry286MB commented
Schema:
table StringType { value: string; } table IntType { value: int; } table SingleType { value: float; } table BoolType { value: bool; } union BaseType { StringType, IntType, SingleType, BoolType } table ScriptCallParam { name: string; value: BaseType; }
Generated BaseType.cs:
public enum BaseType : byte { NONE = 0, StringType = 1, IntType = 2, SingleType = 3, BoolType = 4, };
Issue on ScriptCallParam.cs: BaseTypeVerify doesn't exist
[...] static public class ScriptCallParamVerify { static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos) { return verifier.VerifyTableStart(tablePos) && verifier.VerifyString(tablePos, 4 /*Name*/, false) && verifier.VerifyField(tablePos, 6 /*ValueType*/, 1 /*BaseType*/, 1, false) && verifier.VerifyUnion(tablePos, 6, 8 /*Value*/, BaseTypeVerify.Verify, false) && verifier.VerifyTableEnd(tablePos); } }
rodry286MB commented
using to reclamos on autentify
rodry286MB commented
tengo problemas de uso