Skip to content

Conversation

@goneri
Copy link
Contributor

@goneri goneri commented Jun 12, 2015

This patch resolve two issues:

  • 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()
  • the patch, with https://github.com/nicolaiarocci/eve/pull/656 will allow
    the use of sub-embedded document

@goneri
Copy link
Contributor Author

goneri commented Jun 12, 2015

The unit-test failure is fixed by this pull request: #48

goneri added a commit to goneri/eve that referenced this pull request Jun 12, 2015
embedded_fields may point on a field that come from another embedded
document. For example, ['a.b.c', 'a.b', 'a']

The strategy is to sort out the different embedded_fields depending on
their number of '.'. This way, the ones with the greatest depth level
come last.

Combined with pyeve/eve-sqlalchemy#47 it's
now possible to do include multi-level embedded resource with Eve-SQLAlchemy.
@goneri goneri force-pushed the embedded_with_DOMAIN branch 3 times, most recently from dff7ba6 to c38ac94 Compare June 16, 2015 12:59
This patch resolve two issues:
- 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()
- the patch, with https://github.com/nicolaiarocci/eve/pull/656 will allow
  the use of sub-embedded document
@goneri goneri force-pushed the embedded_with_DOMAIN branch from c38ac94 to 576979b Compare June 16, 2015 13:51
amleczko added a commit that referenced this pull request Jun 17, 2015
embedded table: use DOMAIN to look up the resource fields
@amleczko amleczko merged commit 9ad1f9e into pyeve:master Jun 17, 2015
goneri added a commit to goneri/eve that referenced this pull request Jun 24, 2015
embedded_fields may point on a field that come from another embedded
document. For example, ['a.b.c', 'a.b', 'a']

The strategy is to sort out the different embedded_fields depending on
their number of '.'. This way, the ones with the greatest depth level
come last.

Combined with pyeve/eve-sqlalchemy#47 it's
now possible to do include multi-level embedded resource with Eve-SQLAlchemy.
@goneri goneri deleted the embedded_with_DOMAIN branch December 29, 2021 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants