Skip to content

Commit

Permalink
CLI: doctor: warn on schema with empty data and encoding fields (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-rms committed Nov 3, 2022
1 parent 066f03b commit 8144406
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions go/cli/mcap/cmd/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,12 @@ func (doctor *mcapDoctor) Examine() error {
doctor.error("Failed to parse schema:", err)
}

if schema.Encoding == "" && len(schema.Data) > 0 {
doctor.error("Schema.data field should not be set when Schema.encoding is empty")
if schema.Encoding == "" {
if len(schema.Data) == 0 {
doctor.warn("Schema with ID: %d, Name: %d has empty Encoding and Data fields", schema.ID, schema.Name)
} else {
doctor.error("Schema with ID: %d has empty Encoding but Data contains: %s", schema.ID, string(schema.Data))
}
}

if schema.ID == 0 {
Expand Down

0 comments on commit 8144406

Please sign in to comment.