nats-io / nats.rs

Rust client for NATS, the cloud native messaging system.
Apache License 2.0
1.04k stars 165 forks source link

nats: De/Ser using `sample_freq` instead of `sample_frequency` #1303

Closed bengsparks closed 1 month ago

bengsparks commented 1 month ago

Addendum to #1300 for the nats module.

This PR instructs serde to rename sample_frequency into sample_freq during de/serialization. It also introduces a module for converting the u8 into a String.

Finally, this PR adds a test in nats/tests/jetstream.rs that can be executed via cargo test -- jetstream_consumer_configs_sample_frequency, which checks that the stored config of the consumer now contains the correctly set field. Removing the rename = sample_freq directive from the ConsumerConfig type causes this test to fail, so all seems to be correct.