Skip to content

Commit

Permalink
Leave in DoNotUse fields, but stop warning on missing type info
Browse files Browse the repository at this point in the history
  • Loading branch information
hasty committed Nov 4, 2024
1 parent 6e00f9e commit 8fd4c32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
5 changes: 1 addition & 4 deletions matter/spec/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package spec

import (
"log/slog"
"strings"

"github.com/project-chip/alchemy/internal/log"
"github.com/project-chip/alchemy/matter"
Expand Down Expand Up @@ -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)
Expand Down
19 changes: 10 additions & 9 deletions matter/spec/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8fd4c32

Please sign in to comment.