Fix verification for C# unions (#7970)

* Fix verification for unions

* Run scripts\generate_code.py

---------

Co-authored-by: Michael Le <michael.le647@gmail.com>
This commit is contained in:
Curt Hagenlocher
2023-09-30 18:54:48 -07:00
committed by GitHub
parent 1fdb5d263a
commit f4e23bf91e
13 changed files with 248 additions and 217 deletions

View File

@@ -37,25 +37,6 @@ public class ValueUnion {
}
}
static public class ValueVerify
{
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
{
bool result = true;
switch((Value)typeId)
{
case Value.IntValue:
result = union_value_collsion.IntValueVerify.Verify(verifier, tablePos);
break;
default: result = true;
break;
}
return result;
}
}
public class ValueUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
public override bool CanConvert(System.Type objectType) {
return objectType == typeof(ValueUnion) || objectType == typeof(System.Collections.Generic.List<ValueUnion>);
@@ -97,6 +78,25 @@ public class ValueUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
}
}
static public class ValueVerify
{
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
{
bool result = true;
switch((Value)typeId)
{
case Value.IntValue:
result = union_value_collsion.IntValueVerify.Verify(verifier, tablePos);
break;
default: result = true;
break;
}
return result;
}
}
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public enum Other : byte
{
@@ -125,25 +125,6 @@ public class OtherUnion {
}
}
static public class OtherVerify
{
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
{
bool result = true;
switch((Other)typeId)
{
case Other.IntValue:
result = union_value_collsion.IntValueVerify.Verify(verifier, tablePos);
break;
default: result = true;
break;
}
return result;
}
}
public class OtherUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
public override bool CanConvert(System.Type objectType) {
return objectType == typeof(OtherUnion) || objectType == typeof(System.Collections.Generic.List<OtherUnion>);
@@ -185,6 +166,25 @@ public class OtherUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
}
}
static public class OtherVerify
{
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
{
bool result = true;
switch((Other)typeId)
{
case Other.IntValue:
result = union_value_collsion.IntValueVerify.Verify(verifier, tablePos);
break;
default: result = true;
break;
}
return result;
}
}
public struct IntValue : IFlatbufferObject
{
private Table __p;