fotinakis / jsonapi-serializers

Pure Ruby readonly serializers for the JSON:API spec.
MIT License
413 stars 91 forks source link

Duplicate resource in response document. #95

Open beauby opened 7 years ago

beauby commented 7 years ago

I was writing a benchmark to compare AMS, jsonapi-rb and jsonapi-serializers, and came across the following bug:

When a primary resource can be reached as an included related resource, it will appear both in the primary and included sections of the response document, although the spec states that

A compound document MUST NOT include more than one resource object for each type and id pair.

fotinakis commented 7 years ago

Thanks for the report. This makes sense, we de-dupe everything in the included section, but not between included and primary (so if there is a circular reference back to the primary, it would be also in included).