diff --git a/matter/spec/attributes.go b/matter/spec/attributes.go index 6701c73..3591777 100644 --- a/matter/spec/attributes.go +++ b/matter/spec/attributes.go @@ -2,7 +2,6 @@ package spec import ( "log/slog" - "strings" "github.com/project-chip/alchemy/internal/log" "github.com/project-chip/alchemy/matter" @@ -30,9 +29,7 @@ func (s *Section) toAttributes(d *Doc, cluster *matter.Cluster, pc *parseContext if err != nil { return } - if strings.EqualFold(attr.Name, "DoNotUse") { - continue - } + attr.Name = matter.StripTypeSuffixes(attr.Name) attr.Conformance = ti.ReadConformance(row, matter.TableColumnConformance) attr.Type, err = ti.ReadDataType(row, matter.TableColumnType) diff --git a/matter/spec/field.go b/matter/spec/field.go index 0b9010e..08e105e 100644 --- a/matter/spec/field.go +++ b/matter/spec/field.go @@ -19,20 +19,20 @@ func (d *Doc) readFields(ti *TableInfo, entityType types.EntityType, parent type ids := make(map[uint64]*matter.Field) for row := range ti.Body() { f := matter.NewField(row, parent) - f.Name, err = ti.ReadValue(row, matter.TableColumnName) + var name string + name, err = ti.ReadValue(row, matter.TableColumnName) if err != nil { return } - if strings.EqualFold(f.Name, "DoNotUse") { - slog.Info("skipping field") - continue - } - f.Name = matter.StripTypeSuffixes(f.Name) + f.Name = matter.StripTypeSuffixes(name) f.Conformance = ti.ReadConformance(row, matter.TableColumnConformance) f.Type, err = ti.ReadDataType(row, matter.TableColumnType) if err != nil { - slog.Debug("error reading field data type", slog.String("path", d.Path.String()), slog.String("name", f.Name), slog.Any("error", err)) - err = nil + if !conformance.IsDeprecated(f.Conformance) && !conformance.IsDisallowed(f.Conformance) { + // Clusters inheriting from other clusters don't supply type information, nor do attributes that are deprecated or disallowed + slog.Debug("error reading field data type", slog.String("path", d.Path.String()), slog.String("name", name), slog.Any("error", err)) + err = nil + } } f.Constraint = ti.ReadConstraint(row, matter.TableColumnConstraint) @@ -62,7 +62,7 @@ func (d *Doc) readFields(ti *TableInfo, entityType types.EntityType, parent type id := f.ID.Value() existing, ok := ids[id] if ok { - slog.Error("duplicate field ID", log.Path("source", f), slog.String("name", f.Name), slog.Uint64("id", id), log.Path("original", existing)) + slog.Error("duplicate field ID", log.Path("source", f), slog.String("name", name), slog.Uint64("id", id), log.Path("original", existing)) continue } ids[id] = f @@ -97,6 +97,7 @@ func (d *Doc) readFields(ti *TableInfo, entityType types.EntityType, parent type } } f.Name = CanonicalName(f.Name) + fields = append(fields, f) } return