Repository metrics
- Stars
- (74 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Currently I'm using encodePretty to generate swagger.json. However, encodePretty is not exactly a "drop-in replacement for aeson's encode" since it relies on toJSON while encode uses toEncoding.
This results in different key ordering on 32-bit and 64-bit machines and unnecessary diffs for swagger.json when locally someone has a different number of bits.
IIUC we provide toEncoding method implementations for some types to enforce key ordering for InsOrdHashMaps. However, we don't do that for many record types, such as Info and therefore we get different field ordering in encoding for those types.
Also, if I get it right, DEFINE_ENCODING provides an SoP-derived encoding that is architecture-independent.
@phadej would it be sufficient to add DEFINE_TOENCODING for all record types that constitute Swagger to get an architecture-independent toEncoding for Swagger?
It would be extra nice to also have an encodePretty that would use toEncoding rather than toJSON and preserve the ordering of keys.