Skip to content

Commit

Permalink
Use schema ID returned from GetID() (fixes confluentinc#848)
Browse files Browse the repository at this point in the history
  • Loading branch information
perdue committed Oct 9, 2022
1 parent ac9817f commit e714a40
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion schemaregistry/serde/serde.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,13 @@ func (s *BaseSerializer) GetID(topic string, msg interface{}, info schemaregistr
if err != nil {
return -1, err
}
_, err := s.Client.GetID(subject, info, false)
id, err = s.Client.GetID(subject, info, false)
if err != nil {
return -1, err
}
if id != useSchemaID {
return -1, fmt.Errorf("failed to match schema ID (%d != %d)", id, useSchemaID)
}
} else if useLatest {
metadata, err := s.Client.GetLatestSchemaMetadata(subject)
if err != nil {
Expand Down

0 comments on commit e714a40

Please sign in to comment.