My program depends on a library that decodes JSON that I provide into its internal data type.
The library tries to encapsulate too much. It hides connection details, data serialization format and the RPC used under the hood so that it's easy to use.
The problem is that the library rejects JSON that I have to deal with in my environment. In other words, it refuses to work for common errors with JSON payloads like uppercase/lowercase differences, unexpected but harmless keys, recoverable Number/String encoding errors.
I cannot rely on newtype
trick as the library expects concrete data type to work with - not mine. I need to change the "internal" class instance it uses for deserialization.
Having no better idea I forked the library, added that as a dependency built from local directory (also had to delete everything stack
related so that the build would take notice).
The data type was unchanged, only serialization format was altered making this change isolated to problem at hand.
Is there a better way to override class instance definition provided by the library?