Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

[FEAT] Skip nested documents #4

Open
sandroschmid opened this issue Jan 8, 2018 · 0 comments
Open

[FEAT] Skip nested documents #4

sandroschmid opened this issue Jan 8, 2018 · 0 comments

Comments

@sandroschmid
Copy link
Member

sandroschmid commented Jan 8, 2018

Support more complex normalization. E.g. an object like this:

{
  outerDocument: {
    id: 'outer1',
    subDocument: {
      id: 'sub1',
      subSubDocument: { id: 'subSub1', foo: 'bar'  }
    }
  }
};

could be normalized to this:

{
  outer: [{
    id: 'outer1',
    subDocument: {
      id: 'sub1',
      subSubDocument: 'subSub1'
    }
  }],
  subSub: [{ id: 'subSub1', foo: 'bar' }] 
};

by using this schema-configuration:

const schemaConfig: ISchemaConfig = {
  _defaults: { key: 'id' },
  outer: { targets: { 'subDocument.subSubDocument': 'subSub' } },
  subSub: true
};

At the moment of writing normalizing the subSubDocument is only possible by also normalizing the subDocument. Nested targets like subDocument.subSubDocument: 'subSub' are not yet supported.

The schema would support this as it is now but the denormalizer-module has to be adopted as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant