Closed ideasculptor closed 2 years ago
Would this function satisfy your testing requirements?
func NewSchema(id int, schema string, version int, references []Reference, codec *goavro.Codec) Schema
Most definitely. That's exactly what I'm looking for
Hello, I notice that this hasn't made it yet to the official release. Any reason for that?
Just an oversight, thank you, v0.5 is out now.
All members of srclient.Schema are unexported, so it is impossible to populate an instance of srclient.Schema with values. When implementing a mock SchemaRegistryClient, I want to specify the schema instance that should be returned by GetLatestSchema, but I am unable to without resorting to obnoxious reflection tricks.
It's all well and good to create an immutable struct, but how about providing a constructor or a builder of some kind so that it is at least possible to create one for testing. I am reluctant to use the provided MockSchemaRegistryClient because that mock has far too much logic in it, which might include bugs of its own. A mock should be super simple and just allow for the injection of return values for a given method call. And it is easy enough to create such a mock, except that the return value I need to inject cannot be populated because it is immutable and lacks a constructor.
This kind of thing shouldn't be necessary, and wouldn't be if there was a constructor function