From abfb183878fd94ad5812285aed0cc1b1839c1bdf Mon Sep 17 00:00:00 2001 From: marcos Date: Fri, 20 Sep 2024 14:19:26 -0600 Subject: [PATCH 1/4] Match output elements with zcl.xsd schema, and add schema URL in configurator --- zap/generate/cluster.go | 4 +++- zap/generate/configurator.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/zap/generate/cluster.go b/zap/generate/cluster.go index e12a80c3..118f76c7 100644 --- a/zap/generate/cluster.go +++ b/zap/generate/cluster.go @@ -123,7 +123,9 @@ func (tg *TemplateGenerator) populateCluster(configurator *zap.Configurator, cle commands[c] = []*matter.Number{} } - xml.SetOrCreateSimpleElement(cle, "domain", matter.DomainNames[configurator.Doc.Domain]) + de := xml.SetOrCreateSimpleElement(cle, "domain", "") + de.CreateAttr("name", matter.DomainNames[configurator.Doc.Domain]) + de.SetText("") xml.SetOrCreateSimpleElement(cle, "name", cluster.Name, "domain") patchNumberElement(xml.SetOrCreateSimpleElement(cle, "code", "", "name", "domain"), cluster.ID) xml.CreateSimpleElementIfNotExists(cle, "define", define, "code", "name", "domain") diff --git a/zap/generate/configurator.go b/zap/generate/configurator.go index 46a40da1..f9aeebc0 100644 --- a/zap/generate/configurator.go +++ b/zap/generate/configurator.go @@ -47,6 +47,8 @@ func (tg *TemplateGenerator) renderZapTemplate(configurator *zap.Configurator, x ce := x.SelectElement("configurator") if ce == nil { ce = x.CreateElement("configurator") + ce.CreateAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") + ce.CreateAttr("xsi:noNamespaceSchemaLocation", "../../zcl.xsd") } de := ce.SelectElement("domain") From f62572d53b1875f71a35c9c35808c195c89cd3e7 Mon Sep 17 00:00:00 2001 From: marcos <15697303+gmarcosb@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:16:47 -0600 Subject: [PATCH 2/4] Add support for TypeDef (used in camera spec), which allows for mapping to simple types for better referenceability (e.g. for an ID which belongs to some non-global space) --- db/datatypes.go | 18 +++++++++++++++- db/schema.go | 9 ++++++++ errata/spec.go | 5 +++-- matter/cluster.go | 1 + matter/sections.go | 5 ++++- matter/spec/build.go | 10 +++++++++ matter/spec/cluster.go | 14 +++++++++++- matter/spec/datatypes.go | 14 ++++++++++-- matter/spec/global.go | 9 ++++++++ matter/spec/section.go | 17 +++++++++++++-- matter/spec/spec.go | 2 ++ matter/spec/typedef.go | 25 ++++++++++++++++++++++ matter/typedef.go | 46 ++++++++++++++++++++++++++++++++++++++++ matter/types/base.go | 13 +++++++++++- matter/types/entity.go | 1 + zap/datatype.go | 12 ++++------- 16 files changed, 183 insertions(+), 18 deletions(-) create mode 100644 matter/spec/typedef.go create mode 100644 matter/typedef.go diff --git a/db/datatypes.go b/db/datatypes.go index 939d8cf4..21e2adfe 100644 --- a/db/datatypes.go +++ b/db/datatypes.go @@ -15,6 +15,7 @@ func (h *Host) indexDataTypeModels(cxt context.Context, parent *sectionInfo, clu h.indexBitmaps(cluster, parent) h.indexEnums(cluster, parent) h.indexStructs(cluster, parent) + h.indexTypeDefs(cluster, parent) return nil } @@ -55,6 +56,16 @@ func (h *Host) indexEnums(cluster *matter.Cluster, parent *sectionInfo) { } } } +func (h *Host) indexTypeDefs(cluster *matter.Cluster, parent *sectionInfo) { + for _, t := range cluster.TypeDefs { + row := newDBRow() + row.values[matter.TableColumnName] = t.Name + row.values[matter.TableColumnType] = t.Type.Name + row.values[matter.TableColumnDescription] = t.Description + ei := §ionInfo{id: h.nextID(typedefTable), parent: parent, values: row, children: make(map[string][]*sectionInfo)} + parent.children[typedefTable] = append(parent.children[typedefTable], ei) + } +} func (h *Host) readField(f *matter.Field, parent *sectionInfo, tableName string, entityType types.EntityType) { sr := newDBRow() @@ -93,7 +104,7 @@ func (h *Host) indexDataTypes(cxt context.Context, doc *spec.Doc, ds *sectionInf } for _, s := range parse.Skim[*spec.Section](dts.Elements()) { switch s.SecType { - case matter.SectionDataTypeBitmap, matter.SectionDataTypeEnum, matter.SectionDataTypeStruct: + case matter.SectionDataTypeBitmap, matter.SectionDataTypeEnum, matter.SectionDataTypeStruct, matter.SectionDataTypeDef: var t string switch s.SecType { case matter.SectionDataTypeBitmap: @@ -102,6 +113,8 @@ func (h *Host) indexDataTypes(cxt context.Context, doc *spec.Doc, ds *sectionInf t = "enum" case matter.SectionDataTypeStruct: t = "struct" + case matter.SectionDataTypeDef: + t = "typedef" } name := text.TrimCaseInsensitiveSuffix(s.Name, " Type") name = matter.StripDataTypeSuffixes(name) @@ -128,6 +141,9 @@ func (h *Host) indexDataTypes(cxt context.Context, doc *spec.Doc, ds *sectionInf ci.id = h.nextID(structTable) err = h.readTableSection(cxt, doc, ci, s, structField) ds.children[structTable] = append(ds.children[structTable], ci) + case matter.SectionDataTypeDef: + ci.id = h.nextID(typedefTable) + ds.children[typedefTable] = append(ds.children[typedefTable], ci) } if err != nil { return diff --git a/db/schema.go b/db/schema.go index 22ef2bdd..d9b20a51 100644 --- a/db/schema.go +++ b/db/schema.go @@ -22,6 +22,7 @@ var ( deviceTypeRevisionTable = "device_type_revision" deviceTypeConditionTable = "device_type_condition" deviceTypeClusterRequirementTable = "device_type_cluster_requirement" + typedefTable = "typedef" ) type tableSchemaDef struct { @@ -115,6 +116,14 @@ var tableSchema = map[string]tableSchemaDef{ matter.TableColumnConformance, }, }, + typedefTable: { + parent: clusterTable, + columns: []matter.TableColumn{ + matter.TableColumnName, + matter.TableColumnDescription, + matter.TableColumnType, + }, + }, attributeTable: { parent: clusterTable, columns: []matter.TableColumn{ diff --git a/errata/spec.go b/errata/spec.go index c97d7a94..cb993d90 100644 --- a/errata/spec.go +++ b/errata/spec.go @@ -37,9 +37,10 @@ const ( SpecPurposeCluster = 1 << (iota - 1) SpecPurposeDeviceType = 1 << (iota - 1) SpecPurposeCommandArguments = 1 << (iota - 1) + SpecPurposeDataTypesDef = 1 << (iota - 1) - SpecPurposeDataTypes SpecPurpose = SpecPurposeDataTypesBitmap | SpecPurposeDataTypesEnum | SpecPurposeDataTypesStruct - SpecPurposeAll SpecPurpose = SpecPurposeDataTypesBitmap | SpecPurposeDataTypesEnum | SpecPurposeDataTypesStruct | SpecPurposeCluster | SpecPurposeDeviceType | SpecPurposeCommandArguments + SpecPurposeDataTypes SpecPurpose = SpecPurposeDataTypesBitmap | SpecPurposeDataTypesEnum | SpecPurposeDataTypesStruct | SpecPurposeDataTypesDef + SpecPurposeAll SpecPurpose = SpecPurposeDataTypes | SpecPurposeCluster | SpecPurposeDeviceType | SpecPurposeCommandArguments ) var specPurposes = map[string]SpecPurpose{ diff --git a/matter/cluster.go b/matter/cluster.go index 552bdf1e..7246bcb5 100644 --- a/matter/cluster.go +++ b/matter/cluster.go @@ -46,6 +46,7 @@ type Cluster struct { Bitmaps BitmapSet `json:"bitmaps,omitempty"` Enums EnumSet `json:"enums,omitempty"` Structs StructSet `json:"structs,omitempty"` + TypeDefs TypeDefSet `json:"typedefs,omitempty"` Attributes FieldSet `json:"attributes,omitempty"` Events EventSet `json:"events,omitempty"` Commands CommandSet `json:"commands,omitempty"` diff --git a/matter/sections.go b/matter/sections.go index aeb21689..d826aa33 100644 --- a/matter/sections.go +++ b/matter/sections.go @@ -37,6 +37,7 @@ const ( SectionDerivedClusterNamespace SectionModeTags SectionGlobalElements + SectionDataTypeDef ) var TopLevelSectionOrders = map[DocType][]Section{ @@ -65,7 +66,7 @@ var TopLevelSectionOrders = map[DocType][]Section{ }, } -var DataTypeSectionOrder = []Section{SectionPrefix, SectionDataTypeBitmap, SectionDataTypeEnum, SectionDataTypeStruct} +var DataTypeSectionOrder = []Section{SectionPrefix, SectionDataTypeBitmap, SectionDataTypeEnum, SectionDataTypeStruct, SectionDataTypeDef} var sectionTypeStrings = map[Section]string{ SectionPrefix: "Prefix", @@ -83,6 +84,7 @@ var sectionTypeStrings = map[Section]string{ SectionDataTypeBitmap: "Bitmap", SectionDataTypeEnum: "Enum", SectionDataTypeStruct: "Struct", + SectionDataTypeDef: "TypeDef", SectionDeviceType: "DeviceType", SectionStatusCodes: "StatusCodes", SectionAttributes: "Attributes", @@ -126,6 +128,7 @@ var sectionTypeNames = map[Section]string{ SectionDataTypeBitmap: "Bitmap", SectionDataTypeEnum: "Enum", SectionDataTypeStruct: "Struct", + SectionDataTypeDef: "Type Definition", SectionDeviceType: "Device Type", SectionStatusCodes: "Status Codes", SectionAttributes: "Attributes", diff --git a/matter/spec/build.go b/matter/spec/build.go index bf0259f7..a5931442 100644 --- a/matter/spec/build.go +++ b/matter/spec/build.go @@ -219,6 +219,16 @@ func addClusterToSpec(spec *Specification, d *Doc, m *matter.Cluster, specIndex spec.DocRefs[en] = d specIndex.addEntity(en.Name, en, m) } + for _, en := range m.TypeDefs { + _, ok := spec.typeDefIndex[en.Name] + if ok { + slog.Debug("multiple structs with same name", "name", en.Name) + } else { + spec.typeDefIndex[en.Name] = en + } + spec.DocRefs[en] = d + specIndex.addEntity(en.Name, en, m) + } } func (sp *Builder) resolveDataTypeReferences(spec *Specification) { diff --git a/matter/spec/cluster.go b/matter/spec/cluster.go index c877b650..18c04ec6 100644 --- a/matter/spec/cluster.go +++ b/matter/spec/cluster.go @@ -47,17 +47,20 @@ func (s *Section) toClusters(d *Doc, entityMap map[asciidoc.Attributable][]types var bitmaps matter.BitmapSet var enums matter.EnumSet var structs matter.StructSet + var typedefs matter.TypeDefSet for _, s := range elements { switch s.SecType { case matter.SectionDataTypes, matter.SectionStatusCodes: var bs matter.BitmapSet var es matter.EnumSet var ss matter.StructSet - bs, es, ss, err = s.toDataTypes(d, entityMap) + var ts matter.TypeDefSet + bs, es, ss, ts, err = s.toDataTypes(d, entityMap) if err == nil { bitmaps = append(bitmaps, bs...) enums = append(enums, es...) structs = append(structs, ss...) + typedefs = append(typedefs, ts...) } case matter.SectionFeatures: features, err = s.toFeatures(d, entityMap) @@ -72,6 +75,7 @@ func (s *Section) toClusters(d *Doc, entityMap map[asciidoc.Attributable][]types c.Bitmaps = append(c.Bitmaps, bitmaps...) c.Enums = append(c.Enums, enums...) c.Structs = append(c.Structs, structs...) + c.TypeDefs = append(c.TypeDefs, typedefs...) c.Features = features for _, s := range elements { @@ -119,6 +123,8 @@ func (s *Section) toClusters(d *Doc, entityMap map[asciidoc.Attributable][]types c.Enums = append(c.Enums, le) case *matter.Struct: c.Structs = append(c.Structs, le) + case *matter.TypeDef: + c.TypeDefs = append(c.TypeDefs, le) default: slog.Warn("unexpected loose entity", log.Element("path", d.Path, s.Base), "entity", le) } @@ -193,6 +199,12 @@ func assignCustomDataType(c *matter.Cluster, dt *types.DataType) { return } } + for _, t := range c.TypeDefs { + if name == t.Name { + dt.Entity = t + return + } + } } func readRevisionHistory(doc *Doc, s *Section) (revisions []*matter.Revision, err error) { diff --git a/matter/spec/datatypes.go b/matter/spec/datatypes.go index 912d5e6e..e7dfaae6 100644 --- a/matter/spec/datatypes.go +++ b/matter/spec/datatypes.go @@ -17,7 +17,7 @@ import ( "github.com/project-chip/alchemy/matter/types" ) -func (s *Section) toDataTypes(d *Doc, entityMap map[asciidoc.Attributable][]types.Entity) (bitmaps matter.BitmapSet, enums matter.EnumSet, structs matter.StructSet, err error) { +func (s *Section) toDataTypes(d *Doc, entityMap map[asciidoc.Attributable][]types.Entity) (bitmaps matter.BitmapSet, enums matter.EnumSet, structs matter.StructSet, typedefs matter.TypeDefSet, err error) { traverse(d, s, errata.SpecPurposeDataTypes, func(s *Section, parent parse.HasElements, index int) parse.SearchShould { switch s.SecType { @@ -51,6 +51,16 @@ func (s *Section) toDataTypes(d *Doc, entityMap map[asciidoc.Attributable][]type structs = append(structs, me) entityMap[s.Base] = append(entityMap[s.Base], me) } + case matter.SectionDataTypeDef: + var me *matter.TypeDef + me, err = s.toTypeDef(d, entityMap) + if err != nil { + slog.Warn("Error converting section to typedef", log.Element("path", d.Path, s.Base), slog.Any("error", err)) + err = nil + } else { + typedefs = append(typedefs, me) + entityMap[s.Base] = append(entityMap[s.Base], me) + } default: } return parse.SearchShouldContinue @@ -145,7 +155,7 @@ func (d *Doc) readFields(headerRowIndex int, rows []*asciidoc.TableRow, columnMa return } -var listDataTypeDefinitionPattern = regexp.MustCompile(`(?:list|List|DataTypeList)\[([^\]]+)\]`) +var listDataTypeDefinitionPattern = regexp.MustCompile(`(?:list|List|DataTypeList)\[([^]]+)]`) var asteriskPattern = regexp.MustCompile(`\^[0-9]+\^\s*$`) func (d *Doc) ReadRowDataType(row *asciidoc.TableRow, columnMap ColumnIndex, column matter.TableColumn) (*types.DataType, error) { diff --git a/matter/spec/global.go b/matter/spec/global.go index fb6adc99..aff16e04 100644 --- a/matter/spec/global.go +++ b/matter/spec/global.go @@ -45,6 +45,15 @@ func addGlobalEntities(spec *Specification, doc *Doc) error { spec.structIndex[m.Name] = m } spec.addEntity(m.Name, m, nil) + case *matter.TypeDef: + slog.Debug("Found global typedef", "name", m.Name, "path", doc.Path) + _, ok := spec.typeDefIndex[m.Name] + if ok { + slog.Warn("multiple global typedefs with same name", "name", m.Name) + } else { + spec.typeDefIndex[m.Name] = m + } + spec.addEntity(m.Name, m, nil) case *matter.Command: _, ok := spec.commandIndex[m.Name] if ok { diff --git a/matter/spec/section.go b/matter/spec/section.go index 910c4710..1c08a045 100644 --- a/matter/spec/section.go +++ b/matter/spec/section.go @@ -154,7 +154,7 @@ func AssignSectionTypes(doc *Doc, top *Section) error { assignSectionType(doc, section, getSectionType(ps, section)) switch section.SecType { - case matter.SectionDataTypeBitmap, matter.SectionDataTypeEnum, matter.SectionDataTypeStruct: + case matter.SectionDataTypeBitmap, matter.SectionDataTypeEnum, matter.SectionDataTypeStruct, matter.SectionDataTypeDef: if section.Base.Level > 2 { slog.Debug("Unusual depth for section type", slog.String("name", section.Name), slog.String("type", section.SecType.String()), slog.String("path", doc.Path.String())) } @@ -175,6 +175,8 @@ func assignSectionType(doc *Doc, s *Section, sectionType matter.Section) { ignore = doc.errata.Spec.IgnoreSection(s.Name, errata.SpecPurposeDataTypesEnum) case matter.SectionDataTypeStruct: ignore = doc.errata.Spec.IgnoreSection(s.Name, errata.SpecPurposeDataTypesStruct) + case matter.SectionDataTypeDef: + ignore = doc.errata.Spec.IgnoreSection(s.Name, errata.SpecPurposeDataTypesDef) case matter.SectionCluster: ignore = doc.errata.Spec.IgnoreSection(s.Name, errata.SpecPurposeCluster) case matter.SectionDeviceType: @@ -358,6 +360,8 @@ func deriveSectionType(section *Section, parent *Section) matter.Section { return matter.SectionDataTypeBitmap } else if dataType.BaseType == types.BaseDataTypeCustom { return matter.SectionDataTypeStruct + } else if dataType.BaseType.IsSimple() { + return matter.SectionDataTypeDef } } slog.Debug("unknown section type", "path", section.Doc.Path, "name", name) @@ -440,7 +444,7 @@ func (s *Section) toGlobalObjects(d *Doc, entityMap map[asciidoc.Attributable][] return entities, nil } -var dataTypeDefinitionPattern = regexp.MustCompile(`is\s+derived\s+from\s+(?:<>)?`) +var dataTypeDefinitionPattern = regexp.MustCompile(`is\s+derived\s+from\s+(?:<>)?`) func (s *Section) GetDataType() *types.DataType { var dts string @@ -514,6 +518,15 @@ func findLooseEntities(doc *Doc, section *Section, entityMap map[asciidoc.Attrib } else { entities = append(entities, s) } + case matter.SectionDataTypeDef: + var t *matter.TypeDef + t, err = section.toTypeDef(doc, entityMap) + if err != nil { + slog.Warn("Error converting loose section to typedef", log.Element("path", doc.Path, section.Base), slog.Any("error", err)) + err = nil + } else { + entities = append(entities, t) + } case matter.SectionGlobalElements: var ges []types.Entity ges, err = section.toGlobalElements(doc, entityMap) diff --git a/matter/spec/spec.go b/matter/spec/spec.go index 3cf50da3..fc03c57f 100644 --- a/matter/spec/spec.go +++ b/matter/spec/spec.go @@ -19,6 +19,7 @@ type Specification struct { bitmapIndex map[string]*matter.Bitmap enumIndex map[string]*matter.Enum structIndex map[string]*matter.Struct + typeDefIndex map[string]*matter.TypeDef commandIndex map[string]*matter.Command eventIndex map[string]*matter.Event @@ -40,6 +41,7 @@ func newSpec() *Specification { bitmapIndex: make(map[string]*matter.Bitmap), enumIndex: make(map[string]*matter.Enum), structIndex: make(map[string]*matter.Struct), + typeDefIndex: make(map[string]*matter.TypeDef), commandIndex: make(map[string]*matter.Command), eventIndex: make(map[string]*matter.Event), diff --git a/matter/spec/typedef.go b/matter/spec/typedef.go new file mode 100644 index 00000000..01b2fbe6 --- /dev/null +++ b/matter/spec/typedef.go @@ -0,0 +1,25 @@ +package spec + +import ( + "fmt" + + "github.com/project-chip/alchemy/asciidoc" + "github.com/project-chip/alchemy/internal/text" + "github.com/project-chip/alchemy/matter" + "github.com/project-chip/alchemy/matter/types" +) + +func (s *Section) toTypeDef(d *Doc, entityMap map[asciidoc.Attributable][]types.Entity) (ms *matter.TypeDef, err error) { + name := text.TrimCaseInsensitiveSuffix(s.Name, " Type") + ms = matter.NewTypeDef(s.Base) + ms.Name = name + + dt := s.GetDataType() + if (dt == nil) || !dt.BaseType.IsSimple() { + return nil, fmt.Errorf("unknown typedef data type: %s", dt.Name) + } + ms.Type = dt + entityMap[s.Base] = append(entityMap[s.Base], ms) + ms.Name = CanonicalName(ms.Name) + return +} diff --git a/matter/typedef.go b/matter/typedef.go new file mode 100644 index 00000000..961d7d75 --- /dev/null +++ b/matter/typedef.go @@ -0,0 +1,46 @@ +package matter + +import ( + "github.com/project-chip/alchemy/asciidoc" + "github.com/project-chip/alchemy/matter/types" +) + +type TypeDef struct { + entity + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + Type *types.DataType `json:"type,omitempty"` +} + +func NewTypeDef(source asciidoc.Element) *TypeDef { + return &TypeDef{ + entity: entity{source: source}, + } +} + +func (*TypeDef) EntityType() types.EntityType { + return types.EntityTypeDef +} + +func (s *TypeDef) Clone() *TypeDef { + ns := &TypeDef{Name: s.Name, Description: s.Description, Type: s.Type} + return ns +} + +func (s *TypeDef) Inherit(parent *TypeDef) { + if len(s.Description) == 0 { + s.Description = parent.Description + } + s.Type = s.Type +} + +type TypeDefSet []*TypeDef + +func (ss TypeDefSet) Identifier(name string) (types.Entity, bool) { + for _, e := range ss { + if e.Name == name { + return e, true + } + } + return nil, false +} diff --git a/matter/types/base.go b/matter/types/base.go index 8946c94b..b83bb912 100644 --- a/matter/types/base.go +++ b/matter/types/base.go @@ -89,7 +89,6 @@ const ( BaseDataTypeTag BaseDataTypeMessageID - BaseDataTypeDeviceType ) type HasBaseDataType interface { @@ -121,6 +120,18 @@ func (bdt BaseDataType) String() string { return BaseDataTypeName(bdt) } +func (bdt BaseDataType) IsSimple() bool { + switch bdt { + case BaseDataTypeUInt8, BaseDataTypeUInt16, BaseDataTypeUInt24, BaseDataTypeUInt32, + BaseDataTypeUInt40, BaseDataTypeUInt48, BaseDataTypeUInt56, BaseDataTypeUInt64, + BaseDataTypeInt8, BaseDataTypeInt16, BaseDataTypeInt24, BaseDataTypeInt32, + BaseDataTypeInt40, BaseDataTypeInt48, BaseDataTypeInt56, BaseDataTypeInt64, + BaseDataTypeString: + return true + } + return false +} + func BaseDataTypeName(baseDataType BaseDataType) string { switch baseDataType { case BaseDataTypeUnknown: diff --git a/matter/types/entity.go b/matter/types/entity.go index c24e0109..790822dd 100644 --- a/matter/types/entity.go +++ b/matter/types/entity.go @@ -27,6 +27,7 @@ const ( EntityTypeCondition EntityTypeStructField EntityTypeElementRequirement + EntityTypeDef ) type Entity interface { diff --git a/zap/datatype.go b/zap/datatype.go index 1cf31ad8..59059736 100644 --- a/zap/datatype.go +++ b/zap/datatype.go @@ -413,14 +413,6 @@ func ToBaseDataType(s string) types.BaseDataType { } return types.BaseDataTypeUnknown } - -func ConvertZapToDataTypeName(s string) string { - if z, ok := zapToMatterMap[strings.ToLower(s)]; ok { - return z - } - return s -} - func maxOver255Bytes(fs matter.FieldSet, f *matter.Field) bool { if f.Constraint == nil { return false @@ -454,6 +446,10 @@ func FieldToZapDataType(fs matter.FieldSet, f *matter.Field) string { if f.Type.IsArray() { return DataTypeName(f.Type.EntryType) } + if t, isTypeDef := f.Type.Entity.(*matter.TypeDef); isTypeDef { + return DataTypeName(t.Type) + } + return DataTypeName(f.Type) } From dfbcb8141e92639a3b0bcc55e12a48cc76d409d9 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Mon, 30 Sep 2024 08:06:56 -0700 Subject: [PATCH 3/4] Fix build error in spec Missed this in conflict resolution --- matter/spec/build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matter/spec/build.go b/matter/spec/build.go index 8a02f6e3..02a40504 100644 --- a/matter/spec/build.go +++ b/matter/spec/build.go @@ -239,7 +239,7 @@ func addClusterToSpec(spec *Specification, d *Doc, m *matter.Cluster) { spec.typeDefIndex[en.Name] = en } spec.DocRefs[en] = d - specIndex.addEntity(en.Name, en, m) + spec.addEntityByName(en.Name, en, m) } } From 99e5bb6cb686f257beb27b3bede1e05044542f53 Mon Sep 17 00:00:00 2001 From: Marcos B <15697303+gmarcosb@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:59:01 -0600 Subject: [PATCH 4/4] Apply to existing templates Co-authored-by: Hasty Granbery --- zap/generate/configurator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zap/generate/configurator.go b/zap/generate/configurator.go index f9aeebc0..a075c40c 100644 --- a/zap/generate/configurator.go +++ b/zap/generate/configurator.go @@ -47,9 +47,9 @@ func (tg *TemplateGenerator) renderZapTemplate(configurator *zap.Configurator, x ce := x.SelectElement("configurator") if ce == nil { ce = x.CreateElement("configurator") - ce.CreateAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") - ce.CreateAttr("xsi:noNamespaceSchemaLocation", "../../zcl.xsd") } + ce.CreateAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") + ce.CreateAttr("xsi:noNamespaceSchemaLocation", "../../zcl.xsd") de := ce.SelectElement("domain") if de == nil {