twmb / franz-go

franz-go contains a feature complete, pure Go library for interacting with Kafka from 0.8.0 through 3.6+. Producing, consuming, transacting, administrating, etc.
BSD 3-Clause "New" or "Revised" License
1.6k stars 158 forks source link

SR: prevent panic when no decode function is registered #745

Closed lovromazgon closed 1 month ago

lovromazgon commented 1 month ago

A small fix for a possible panic when a type is registered without a decode function. The test kinda hides this possibility, because Serde has a default DecodeFn option. This case is more likely to hit when Serde is instantiated without that option.

I removed the decode test case for schema ID 100, as it was the same as the one for ID 99, instead I added one with ID 101 which has a registered type, but no decode function.

twmb commented 1 month ago

Thanks!