it's now possible to have a resource field that is a relation to
another relation, even if the name doesn't match. For example,
product_stable and product_devel are two one-to-one field with a
relationship to product
when we associate a foreign resource, we let
eve.utils.embedded_document() decide what field should be import in
the embedded resource. Previously, all the fields of the embedded
resource were imported, with the thread of potential endless loops.
For example, a any-to-one relation called
foo with an associate to bar that we pull with embedded.
bar has got a foo_collection with a link to foo. Previously, the
foo_collection filed was automatically added in the list of field of bar.
This was enough to create a resource loop in lookup_foreign_resource.
eve.utils.embedded_document() was confused because it was try to
resolve itself embedded resource that were already pulled by
eve_sqlalchemy.utils.sqla_object_to_dict(). Because of that, all the
embedd resources were prefixed with a ID_FIELD in the final JSON.
We now only retrieve the ID_FIELD value, as expected by
embedded_document()
This patch resolve two issues:
foo
with an associate tobar
that we pull with embedded.bar
has got afoo_collection
with a link tofoo
. Previously, thefoo_collection
filed was automatically added in the list of field ofbar
. This was enough to create a resource loop inlookup_foreign_resource
.