Field inconsistencies with multiple handlers for one model

Issue #101 new
Jim Sizelove
created an issue

I have two handlers that represent one model with a slightly different set of fields. Sometimes a field will be missing in a resource where I expect it. This behavior seems to be consistent in a session of the server. When I restart the server, the missing field may (or may not) start showing up. It will consistently be visible (or missing) until the next time the server is restarted.

I tracked this down to the in_typemapper() method of the Emitter. I believe this inconsistency has to do with the order that the typemapper dictionary iterates over its items.

I have attached a patch that returns the handler of the emitter if it matches the type and anonymous requirements of the in_typemapper() method. Otherwise, the existing code looks for a match in the typemapper dictionary.

This patch is good enough for my purposes, though I suspect it may still fall down for nested models.

This may be related to <<issue 64>>.

Comments (2)

  1. Sean Hayes

    I have this problem too. Since the old code iterates over a dictionary, which don't have reliable ordering, it chooses one handler some of the time and another handler the rest of the time. I only caught this by running my test suite multiple times and I came pretty close to pushing broken code

  2. Log in to comment