diff --git a/internal/confgen/document_parser.go b/internal/confgen/document_parser.go index 6b87b7ee..4ce5dfdf 100644 --- a/internal/confgen/document_parser.go +++ b/internal/confgen/document_parser.go @@ -473,51 +473,80 @@ func (sp *documentParser) parseUnionMessage(field *Field, msg protoreflect.Messa if valueFD.Kind() != protoreflect.MessageKind { return false, xerrors.Errorf("union value (oneof) as scalar type not supported: %s", valueFD.FullName()) } - // MUST be message type. - md := valueFD.Message() - fieldMsg := fieldValue.Message() - for i := 0; i < md.Fields().Len(); i++ { - fd := md.Fields().Get(i) - valNodeName := unionDesc.ValueFieldName() + strconv.Itoa(int(fd.Number())) - valNode := node.FindChild(valNodeName) - err := func() error { - subField := parseFieldDescriptor(fd, sp.GetSep(), sp.GetSubsep()) - defer subField.release() - if valNode == nil && xproto.GetFieldDefaultValue(fd) != "" { - // if this field has a default value, use virtual node - valNode = &book.Node{ - Name: node.Name, - Value: node.Value, - } + valueField := parseFieldDescriptor(valueFD, sp.GetSep(), sp.GetSubsep()) + if valueField.opts.GetProp().GetIntegrated() { + valNode := node.FindChild(unionDesc.ValueFieldName() + "1") + if valNode == nil && xproto.GetFieldDefaultValue(field.fd) != "" { + // if this field has a default value, use virtual node + valNode = &book.Node{ + Name: node.Name, + Value: node.Value, } - if valNode == nil { - if sp.IsFieldOptional(subField) { - // field not found and is optional, just return nil. - return nil - } - kvs := node.DebugNameKV() - kvs = append(kvs, - xerrors.KeyPBFieldType, xproto.GetFieldTypeName(fd), - xerrors.KeyPBFieldName, fd.FullName(), - xerrors.KeyPBFieldOpts, subField.opts, - ) - return xerrors.WrapKV(xerrors.E2014(subField.opts.Name), kvs...) + } + if valNode == nil { + if sp.IsFieldOptional(field) { + // field not found and is optional, just return nil. + return false, nil } - crossNodeValues := []string{valNode.Value} - if fieldCount := fieldprop.GetUnionCrossFieldCount(subField.opts.Prop); fieldCount > 0 { - for j := 1; j < fieldCount; j++ { - nodeName := unionDesc.ValueFieldName() + strconv.Itoa(int(fd.Number())+j) - node := node.FindChild(nodeName) - if node == nil { - break + kvs := node.DebugNameKV() + kvs = append(kvs, + xerrors.KeyPBFieldType, xproto.GetFieldTypeName(field.fd), + xerrors.KeyPBFieldName, field.fd.FullName(), + xerrors.KeyPBFieldOpts, field.opts, + ) + return false, xerrors.WrapKV(xerrors.E2014(field.opts.Name), kvs...) + } + present, err = sp.parseIncellStruct(fieldValue, valNode.Value, field.opts.GetProp().GetForm(), field.sep) + if err != nil { + return false, err + } + } else { + // MUST be message type. + md := valueFD.Message() + fieldMsg := fieldValue.Message() + for i := 0; i < md.Fields().Len(); i++ { + fd := md.Fields().Get(i) + valNodeName := unionDesc.ValueFieldName() + strconv.Itoa(int(fd.Number())) + valNode := node.FindChild(valNodeName) + err := func() error { + subField := parseFieldDescriptor(fd, sp.GetSep(), sp.GetSubsep()) + defer subField.release() + if valNode == nil && xproto.GetFieldDefaultValue(fd) != "" { + // if this field has a default value, use virtual node + valNode = &book.Node{ + Name: node.Name, + Value: node.Value, } - crossNodeValues = append(crossNodeValues, node.Value) } + if valNode == nil { + if sp.IsFieldOptional(subField) { + // field not found and is optional, just return nil. + return nil + } + kvs := node.DebugNameKV() + kvs = append(kvs, + xerrors.KeyPBFieldType, xproto.GetFieldTypeName(fd), + xerrors.KeyPBFieldName, fd.FullName(), + xerrors.KeyPBFieldOpts, subField.opts, + ) + return xerrors.WrapKV(xerrors.E2014(subField.opts.Name), kvs...) + } + crossNodeValues := []string{valNode.Value} + if fieldCount := fieldprop.GetUnionCrossFieldCount(subField.opts.Prop); fieldCount > 0 { + for j := 1; j < fieldCount; j++ { + nodeName := unionDesc.ValueFieldName() + strconv.Itoa(int(fd.Number())+j) + node := node.FindChild(nodeName) + if node == nil { + break + } + crossNodeValues = append(crossNodeValues, node.Value) + } + } + return sp.parseUnionMessageField(subField, fieldMsg, crossNodeValues) + }() + if err != nil { + return false, xerrors.WrapKV(err, valNode.DebugNameKV()...) } - return sp.parseUnionMessageField(subField, fieldMsg, crossNodeValues) - }() - if err != nil { - return false, xerrors.WrapKV(err, valNode.DebugNameKV()...) } } msg.Set(valueFD, fieldValue) diff --git a/internal/confgen/table_parser.go b/internal/confgen/table_parser.go index 345de887..05c8af55 100644 --- a/internal/confgen/table_parser.go +++ b/internal/confgen/table_parser.go @@ -632,35 +632,47 @@ func (sp *tableParser) parseUnionMessage(msg protoreflect.Message, field *Field, if valueFD.Kind() != protoreflect.MessageKind { return false, xerrors.Errorf("union value (oneof) as scalar type not supported: %s", valueFD.FullName()) } - // MUST be message type. - md := valueFD.Message() - fieldMsg := fieldValue.Message() - for i := 0; i < md.Fields().Len(); i++ { - fd := md.Fields().Get(i) - valColName := prefix + unionDesc.ValueFieldName() + strconv.Itoa(int(fd.Number())) - err := func() error { - subField := parseFieldDescriptor(fd, sp.GetSep(), sp.GetSubsep()) - defer subField.release() - // incell scalar - cell, err := rc.Cell(valColName, sp.IsFieldOptional(subField)) - if err != nil { - return err - } - crossCellDataList := []string{cell.Data} - if fieldCount := fieldprop.GetUnionCrossFieldCount(subField.opts.Prop); fieldCount > 0 { - for j := 1; j < fieldCount; j++ { - colName := prefix + unionDesc.ValueFieldName() + strconv.Itoa(int(fd.Number())+j) - c, err := rc.Cell(colName, sp.IsFieldOptional(subField)) - if err != nil { - break + valueField := parseFieldDescriptor(valueFD, sp.GetSep(), sp.GetSubsep()) + if valueField.opts.GetProp().GetIntegrated() { + cell, err := rc.Cell(prefix+unionDesc.ValueFieldName()+"1", false) + if err != nil { + return false, err + } + present, err = sp.parseIncellStruct(fieldValue, cell.Data, valueField.opts.GetProp().GetForm(), valueField.sep) + if err != nil { + return false, err + } + } else { + // MUST be message type. + md := valueFD.Message() + fieldMsg := fieldValue.Message() + for i := 0; i < md.Fields().Len(); i++ { + fd := md.Fields().Get(i) + valColName := prefix + unionDesc.ValueFieldName() + strconv.Itoa(int(fd.Number())) + err := func() error { + subField := parseFieldDescriptor(fd, sp.GetSep(), sp.GetSubsep()) + defer subField.release() + // incell scalar + cell, err := rc.Cell(valColName, sp.IsFieldOptional(subField)) + if err != nil { + return err + } + crossCellDataList := []string{cell.Data} + if fieldCount := fieldprop.GetUnionCrossFieldCount(subField.opts.Prop); fieldCount > 0 { + for j := 1; j < fieldCount; j++ { + colName := prefix + unionDesc.ValueFieldName() + strconv.Itoa(int(fd.Number())+j) + c, err := rc.Cell(colName, sp.IsFieldOptional(subField)) + if err != nil { + break + } + crossCellDataList = append(crossCellDataList, c.Data) } - crossCellDataList = append(crossCellDataList, c.Data) } + return sp.parseUnionMessageField(subField, fieldMsg, crossCellDataList) + }() + if err != nil { + return false, xerrors.WrapKV(err, rc.CellDebugKV(valColName)...) } - return sp.parseUnionMessageField(subField, fieldMsg, crossCellDataList) - }() - if err != nil { - return false, xerrors.WrapKV(err, rc.CellDebugKV(valColName)...) } } msg.Set(valueFD, fieldValue) diff --git a/internal/protogen/exporter.go b/internal/protogen/exporter.go index 84d2213a..b1965233 100644 --- a/internal/protogen/exporter.go +++ b/internal/protogen/exporter.go @@ -216,7 +216,7 @@ func (x *sheetExporter) exportUnion() error { for _, field := range x.ws.Fields { ename := "TYPE_" + strcase.ToScreamingSnake(field.Name) - x.g.P(" ", strings.TrimSpace(field.Name), " ", strcase.ToSnake(field.Name), " = ", field.Number, `; // Bound to enum value: `, ename, ".") + x.g.P(" ", strings.TrimSpace(field.Name), " ", strcase.ToSnake(field.Name), " = ", field.Number, genFieldOptionsString(field.Options), `; // Bound to enum value: `, ename, ".") } x.g.P(` }`) x.g.P() @@ -279,7 +279,7 @@ func (x *sheetExporter) exportField(depth int, tagid int, field *internalpb.Fiel label = "optional " } - x.g.P(printer.Indent(depth), label, field.FullType, " ", field.Name, " = ", tagid, " ", genFieldOptionsString(field.Options), ";") + x.g.P(printer.Indent(depth), label, field.FullType, " ", field.Name, " = ", tagid, genFieldOptionsString(field.Options), ";") typeName := field.Type fullTypeName := field.FullType @@ -340,6 +340,9 @@ func (x *sheetExporter) exportField(depth int, tagid int, field *internalpb.Fiel } func genFieldOptionsString(opts *tableaupb.FieldOptions) string { + if opts == nil { + return "" + } jsonName := "" // remember and then clear protobuf built-in options if opts.Prop != nil { @@ -353,7 +356,7 @@ func genFieldOptionsString(opts *tableaupb.FieldOptions) string { } // compose this field options - fieldOpts := "[(tableau.field) = {" + marshalToText(opts) + "}" + fieldOpts := " [(tableau.field) = {" + marshalToText(opts) + "}" if jsonName != "" { fieldOpts += `, json_name="` + jsonName + `"` } diff --git a/internal/protogen/exporter_test.go b/internal/protogen/exporter_test.go index 01d35ec8..905ddacc 100644 --- a/internal/protogen/exporter_test.go +++ b/internal/protogen/exporter_test.go @@ -27,7 +27,7 @@ func Test_genFieldOptionsString(t *testing.T) { Name: "ItemID", }, }, - want: `[(tableau.field) = {name:"ItemID"}]`, + want: ` [(tableau.field) = {name:"ItemID"}]`, }, { name: "name-and-prop", @@ -39,7 +39,7 @@ func Test_genFieldOptionsString(t *testing.T) { }, }, }, - want: `[(tableau.field) = {name:"ItemID" prop:{unique:true}}]`, + want: ` [(tableau.field) = {name:"ItemID" prop:{unique:true}}]`, }, { name: "name-prop-and-json-name", @@ -52,7 +52,7 @@ func Test_genFieldOptionsString(t *testing.T) { }, }, }, - want: `[(tableau.field) = {name:"ItemID" prop:{unique:true}}, json_name="item_id_1"]`, + want: ` [(tableau.field) = {name:"ItemID" prop:{unique:true}}, json_name="item_id_1"]`, }, { name: "name-and-prop-json_name", @@ -64,7 +64,14 @@ func Test_genFieldOptionsString(t *testing.T) { }, }, }, - want: `[(tableau.field) = {name:"ItemID"}, json_name="item_id_1"]`, + want: ` [(tableau.field) = {name:"ItemID"}, json_name="item_id_1"]`, + }, + { + name: "nil", + args: args{ + opts: nil, + }, + want: ``, }, } for _, tt := range tests { diff --git a/internal/protogen/sheet_mode.go b/internal/protogen/sheet_mode.go index 20965fee..192f30c6 100644 --- a/internal/protogen/sheet_mode.go +++ b/internal/protogen/sheet_mode.go @@ -186,11 +186,22 @@ func parseUnionType(ws *internalpb.Worksheet, sheet *book.Sheet, parser book.She if value.Number != nil { number = *value.Number } + name := value.Name + var prop *tableaupb.FieldProp + if desc := types.MatchScalar(name); desc != nil { + name = desc.ScalarType + prop, _ = desc.Prop.FieldProp() + } field := &internalpb.Field{ Number: number, - Name: value.Name, + Name: name, Alias: value.Alias, } + if prop != nil { + field.Options = &tableaupb.FieldOptions{ + Prop: prop, + } + } // create a book parser bp := newTableParser("union", "", "", gen) diff --git a/proto/tableau/protobuf/internal/metabook.proto b/proto/tableau/protobuf/internal/metabook.proto index c1b8c78d..d9776620 100644 --- a/proto/tableau/protobuf/internal/metabook.proto +++ b/proto/tableau/protobuf/internal/metabook.proto @@ -84,23 +84,38 @@ message Metasheet { // Generate ordered map accessers bool ordered_map = 50 [(tableau.field) = {name:"OrderedMap" prop:{optional:true}}]; // Generate index accessers, and multiple index columns are comma-separated. - // Format: [@IndexName], if IndexName is not set, it will be this + // Format: ColumnName[@IndexName]. If IndexName is not set, it will be this // column’s parent struct type name. // - // Composite indexes (or multicolumn indexes) are in the form: ([column1, column2, column3,...])[@IndexName] + // Examples: + // - ID + // - ID@Item + // - ID@Item + // - ID@Item + // + // Composite indexes (or multicolumn indexes) are in the form: + // ([column1, column2, column3,...])<[key1, key2, key3,...]>[@IndexName] // // Examples: - // - ID - // - ID@Item - // - (ID,Type) - // - (ID,Type)@Item - // - ID, (ID,Type)@Item + // - (ID, Name) + // - (ID, Name)@Item + // - (ID, Name)@Item + // - (ID, Name)@Item // // Generated APIs are: // // C++: - // - const std::vector& Find(INDEX_TYPE index) const; + // - using Index_Vector = std::vector; + // - using Index_Map = std::unordered_mapVector>; + // - const Index_Map& Find() const; + // - const Index_Vector* Find(INDEX_TYPE index) const; // - const STRUCT_TYPE* FindFirst(INDEX_TYPE index); + // + // Go: + // - type _Index_Map = map[INDEX_TYPE][]*STRUCT_TYPE + // - func (x *) FindMap() _Index_Map + // - func (x *) Find(index INDEX_TYPE) []*STRUCT_TYPE + // - func (x *) FindFirst(index INDEX_TYPE) *STRUCT_TYPE string index = 51 [(tableau.field) = {name:"Index" prop:{optional:true}}]; // Specify loader language options. diff --git a/proto/tableau/protobuf/tableau.proto b/proto/tableau/protobuf/tableau.proto index a698aeea..8fce8b17 100644 --- a/proto/tableau/protobuf/tableau.proto +++ b/proto/tableau/protobuf/tableau.proto @@ -324,6 +324,9 @@ message FieldProp { // // TODO: use cases for more composite types. int32 cross = 15; + // Whether this union field data is integrated in its Field1 + // as an incell struct. + bool integrated = 16; } // Layout of list and map. diff --git a/proto/tableaupb/internalpb/metabook.pb.go b/proto/tableaupb/internalpb/metabook.pb.go index 706d3957..10066ef0 100644 --- a/proto/tableaupb/internalpb/metabook.pb.go +++ b/proto/tableaupb/internalpb/metabook.pb.go @@ -144,23 +144,38 @@ type Metasheet struct { // Generate ordered map accessers OrderedMap bool `protobuf:"varint,50,opt,name=ordered_map,json=orderedMap,proto3" json:"ordered_map,omitempty"` // Generate index accessers, and multiple index columns are comma-separated. - // Format: [@IndexName], if IndexName is not set, it will be this + // Format: ColumnName[@IndexName]. If IndexName is not set, it will be this // column’s parent struct type name. // - // Composite indexes (or multicolumn indexes) are in the form: ([column1, column2, column3,...])[@IndexName] - // // Examples: // - ID // - ID@Item - // - (ID,Type) - // - (ID,Type)@Item - // - ID, (ID,Type)@Item + // - ID@Item + // - ID@Item + // + // Composite indexes (or multicolumn indexes) are in the form: + // ([column1, column2, column3,...])<[key1, key2, key3,...]>[@IndexName] + // + // Examples: + // - (ID, Name) + // - (ID, Name)@Item + // - (ID, Name)@Item + // - (ID, Name)@Item // // Generated APIs are: // // C++: - // - const std::vector& Find(INDEX_TYPE index) const; + // - using Index_Vector = std::vector; + // - using Index_Map = std::unordered_mapVector>; + // - const Index_Map& Find() const; + // - const Index_Vector* Find(INDEX_TYPE index) const; // - const STRUCT_TYPE* FindFirst(INDEX_TYPE index); + // + // Go: + // - type _Index_Map = map[INDEX_TYPE][]*STRUCT_TYPE + // - func (x *) FindMap() _Index_Map + // - func (x *) Find(index INDEX_TYPE) []*STRUCT_TYPE + // - func (x *) FindFirst(index INDEX_TYPE) *STRUCT_TYPE Index string `protobuf:"bytes,51,opt,name=index,proto3" json:"index,omitempty"` // Specify loader language options. // Valid keys are: OrderedMap, Index. diff --git a/proto/tableaupb/tableau.pb.go b/proto/tableaupb/tableau.pb.go index 14308e16..14d3fb32 100644 --- a/proto/tableaupb/tableau.pb.go +++ b/proto/tableaupb/tableau.pb.go @@ -1256,6 +1256,9 @@ type FieldProp struct { // // TODO: use cases for more composite types. Cross int32 `protobuf:"varint,15,opt,name=cross,proto3" json:"cross,omitempty"` + // Whether this union field data is integrated in its Field1 + // as an incell struct. + Integrated bool `protobuf:"varint,16,opt,name=integrated,proto3" json:"integrated,omitempty"` } func (x *FieldProp) Reset() { @@ -1395,6 +1398,13 @@ func (x *FieldProp) GetCross() int32 { return 0 } +func (x *FieldProp) GetIntegrated() bool { + if x != nil { + return x.Integrated + } + return false +} + var file_tableau_protobuf_tableau_proto_extTypes = []protoimpl.ExtensionInfo{ { ExtendedType: (*descriptorpb.FileOptions)(nil), @@ -1617,7 +1627,7 @@ var file_tableau_protobuf_tableau_proto_rawDesc = []byte{ 0x32, 0x0d, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x61, 0x75, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x26, 0x0a, 0x04, 0x70, 0x72, 0x6f, 0x70, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x61, 0x75, 0x2e, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x04, 0x70, 0x72, 0x6f, 0x70, 0x22, 0xad, 0x03, + 0x65, 0x6c, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x04, 0x70, 0x72, 0x6f, 0x70, 0x22, 0xcd, 0x03, 0x0a, 0x09, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, @@ -1643,7 +1653,9 @@ var file_tableau_protobuf_tableau_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x03, 0x73, 0x65, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x62, 0x73, 0x65, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x75, 0x62, 0x73, 0x65, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x63, 0x72, 0x6f, 0x73, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x63, 0x72, 0x6f, 0x73, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x65, 0x67, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x2a, 0x5b, 0x0a, 0x06, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x59, 0x4f, 0x55, 0x54, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, diff --git a/test/functest/proto/default/common/union.proto b/test/functest/proto/default/common/union.proto index a46e8d47..07bb0b8d 100644 --- a/test/functest/proto/default/common/union.proto +++ b/test/functest/proto/default/common/union.proto @@ -22,7 +22,7 @@ message Target { Pvp pvp = 1; // Bound to enum value 1: TYPE_PVP. Pve pve = 2; // Bound to enum value 2: TYPE_PVE. Story story = 3; // Bound to enum value 3: TYPE_STORY. - Skill skill = 4; // Bound to enum value 4: TYPE_SKILL. + Skill skill = 4 [(tableau.field) = {prop:{integrated:true}}]; // Bound to enum value 4: TYPE_SKILL. Item item = 5; // Bound to enum value 5: TYPE_ITEM. } diff --git a/test/functest/proto/default/excel__metasheet__sheet_mode.proto b/test/functest/proto/default/excel__metasheet__sheet_mode.proto index d2130a3d..d171a860 100644 --- a/test/functest/proto/default/excel__metasheet__sheet_mode.proto +++ b/test/functest/proto/default/excel__metasheet__sheet_mode.proto @@ -116,7 +116,7 @@ message SimpleTarget { oneof value { option (tableau.oneof) = {field:"Field"}; - PVP pvp = 1; // Bound to enum value: TYPE_PVP. + PVP pvp = 1 [(tableau.field) = {prop:{integrated:true}}]; // Bound to enum value: TYPE_PVP. PVE pve = 2; // Bound to enum value: TYPE_PVE. Skill skill = 3; // Bound to enum value: TYPE_SKILL. } diff --git a/test/functest/testdata/default/excel/list/HorizontalList#HorizontalUnionList.csv b/test/functest/testdata/default/excel/list/HorizontalList#HorizontalUnionList.csv index 757292eb..808baddf 100644 --- a/test/functest/testdata/default/excel/list/HorizontalList#HorizontalUnionList.csv +++ b/test/functest/testdata/default/excel/list/HorizontalList#HorizontalUnionList.csv @@ -2,4 +2,4 @@ ID,Target1Type,Target1Field1,Target1Field2,Target1Field3,Target2Type,Target2Fiel "map",[union.Target]enum,union,union,union,enum,union,union,union ID,Target's type,Target's field1,Target's field2,Target's field3,Target's type,Target's field1,Target's field2,Target's field3 1,PVP,1,10,"Apple,Orange,Banana",PVE,"1,100,999","1,2,3","1:10,2:20,3:30" -2,Story,"1001,10","1:Apple,2:Orange","Fragrant:1,Sour:2",Skill,1,2, +2,Story,"1001,10","1:Apple,2:Orange","Fragrant:1,Sour:2",Skill,"1,2",, diff --git a/test/functest/testdata/default/excel/list/VerticalList#VerticalUnionList.csv b/test/functest/testdata/default/excel/list/VerticalList#VerticalUnionList.csv index 97fd8e08..cf92b6e6 100644 --- a/test/functest/testdata/default/excel/list/VerticalList#VerticalUnionList.csv +++ b/test/functest/testdata/default/excel/list/VerticalList#VerticalUnionList.csv @@ -4,5 +4,5 @@ Target's type,Target's field1,Target's field2,Target's field3," Progress" PVP,1,10,"Apple,Orange,Banana",3 PVE,"1,100,999","1,2,3","1:10,2:20,3:30",10 Story,"1001,10","1:Apple,2:Orange","Fragrant:1,Sour:2",10 -Skill,1,2,,8 +Skill,"1,2",,,8 Item,true,"1001,10","1002,10", diff --git a/test/functest/testdata/default/excel/metasheet/SheetMode#UnionSimpleTarget.csv b/test/functest/testdata/default/excel/metasheet/SheetMode#UnionSimpleTarget.csv index 5a46e572..d727112c 100644 --- a/test/functest/testdata/default/excel/metasheet/SheetMode#UnionSimpleTarget.csv +++ b/test/functest/testdata/default/excel/metasheet/SheetMode#UnionSimpleTarget.csv @@ -1,5 +1,5 @@ Name,Alias,Field1,Field2,Field3 -PVP,AliasPVP,"ID +PVP|{integrated:true},AliasPVP,"ID uint32 Note","Damage int64 diff --git a/test/functest/testdata/default/excel/union/Union#PredefinedUnion.csv b/test/functest/testdata/default/excel/union/Union#PredefinedUnion.csv index 3ff28c95..b6a3b7e3 100644 --- a/test/functest/testdata/default/excel/union/Union#PredefinedUnion.csv +++ b/test/functest/testdata/default/excel/union/Union#PredefinedUnion.csv @@ -4,4 +4,4 @@ ID,Target's type,Target's field1,Target's field2,Target's field3," Progress" 1,PVP,1,10,"Apple,Orange,Banana",3 2,PVE,"1,100,999","1,2,3","1:10,2:20,3:30",10 3,Story,"1001,10","1:Apple,2:Orange","Fragrant:1,Sour:2",10 -4,Skill,1,2,,8 +4,Skill,"1,2",,,8 diff --git a/test/functest/testdata/default/xml/Union.xml b/test/functest/testdata/default/xml/Union.xml index 09120763..0e439ce1 100644 --- a/test/functest/testdata/default/xml/Union.xml +++ b/test/functest/testdata/default/xml/Union.xml @@ -15,6 +15,6 @@ type:TYPE_PVE pve:{mission:{id:1 level:100 damage:999} heros:1 heros:2 heros:3 dungeons:{key:1 value:10} dungeons:{key:2 value:20} dungeons:{key:3 value:30}} - + \ No newline at end of file diff --git a/test/functest/testdata/default/yaml/Union.yaml b/test/functest/testdata/default/yaml/Union.yaml index 2e62c77a..c1794dba 100644 --- a/test/functest/testdata/default/yaml/Union.yaml +++ b/test/functest/testdata/default/yaml/Union.yaml @@ -21,8 +21,7 @@ UnionList: Field2: 1:Apple,2:Orange Field3: Fragrant:1,Sour:2 - Type: Skill - Field1: 1 - Field2: 2 + Field1: 1,2 - Type: Item Field1: false Field2: 1001,1