How to generate random json diffs in haskell quickcheck

I need to test the framework that can observe the state of some json http resource (I'm simplifying a bit here) and can send information about its changes to message queue so that client of service based on this framework could reconstruct actual state without polling http resourse.

It's easy to formulate properties for such framework. Let say we have a list of triples State, Diff, Timestamp gen_states = [(gs1, Nothing, t1), (gs2, Just d1-2, t2), (gs3, Just d2-3, t3), (gs4, Just d3-4, t4)] and after mirroring all this state to the http resource (used as test double) we gathered [rs1, rd1-2, rd2-3] where r stands for received.

apply [rd1-2, rd2-3] rs1 == gs4 final states should be the same the same

Also let's say that polling interval was more than the time difference between changes t3 - t2 than we can loose the diff d2-3 but the state still have to be consisted with state that was at previous polling gs2 for example. So we can miss some changes, but the received state should be consisted with some of the previous states that was no later than one polling interval before.

The question is how to create a generator that generates random diffs for json resource, given that resource is always an array of objects that all have id key.

For example initial state could look like that

  {"id": "1", "some": {"complex": "value"}},
  {"id": "2", "other": {"simple": "value"}}

And the next state

  {"id": "1", "some": {"complex": "value"}},
  {"id": "3", "other": "simple_value"}

Which should make diff like

type Id = String
data Diff = Diff {removed :: [Id], added :: [(Id, JsonValue)]}

added = [aesonQQ| {"id": 3, "other": "simple_value"} |]
Diff [2] [added]

I've tried to derive Arbitrary for aeson Object, but got this

<interactive>:15:1: warning: [-Wmissing-methods]
    • No explicit implementation for
    • In the instance declaration for
              Data.Text.Internal.Text Value)’

But even if I would accomplished that how would I specify that added should have new unique id?