flipp-oss / deimos

Framework to work with Kafka, Avro and ActiveRecord
Other
59 stars 22 forks source link

Automatically stringify keys when publishing / comparing #92

Open dorner opened 3 years ago

dorner commented 3 years ago

All actions involving payloads should not care whether the strings are keys or symbols.

E.g. passing a symbolized-key hash into publish should not result in Avro validation errors claiming that values don't exist.

eduardopoleoflipp commented 3 years ago

Please correct me if I'm wrong but it seems that we're already handling this correctly in here. I was able to get a passing test (without any code changes) at the ProducerTest level such as

context 'with a symbolized payload' do
  it 'should publish the message' do
    MyProducer.publish_list(
      [{ test_id: 'foo', some_int: 123 },
       { test_id: 'bar', some_int: 124 }]
    )
    expect(MyProducer.topic).to have_sent(anything)
  end
end

Is there any other publish interface that ultimately doesn't rely on this one?

dorner commented 3 years ago

Hmm... I'm trying to remember the specific use case that was the problem here. I know I've had issues where I passed in symbols and it expected strings in a test... but I don't recall what exactly. Maybe ask people in #ruby-guild to see if anyone can pinpoint the problem case? @eduardopoleoflipp