Skip to content

Heterogenous data lists #1

Open
@innovate-invent

Description

@innovate-invent

Is your feature request related to a problem? Please describe...

The backend I interact with returns a heterogenous list of objects. This can't currently be processed by VuexORM. Each object has an attribute declaring its type.

{
  "type":"container",
  "elements": [
    { "id": 1, "type":"type1", "type1param":"", "common_param":"" },
    { "id": 2, "type":"type1", "type1param":"", "common_param":"" },
    { "id": 3, "type":"type2", "type2param":"", "common_param":"" },
  ]
}

or simply a fetch response can be

[
  { "id": 1, "type":"type1", "type1param":"", "common_param":"" },
  { "id": 2, "type":"type1", "type1param":"", "common_param":"" },
  { "id": 3, "type":"type2", "type2param":"", "common_param":"" },
]

Describe the solution you'd like

Provide a relation that keys on the object type attribute and handles it accordingly.
The relation should accept a mapping of type attribute values to ORM models.

Describe alternatives you've considered

I am currently transforming the data using a request hook to split the lists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions