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

[FEAT] Skip nested documents #4

@saschleu

Description

@saschleu

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions