Skip to content

Allow feature to populate embedded data  #189

@numerical25

Description

@numerical25

Is there a reason JSON:API server doesn't allow the ability to populate embedded data ? Right now it only allows you to populate reference data and it does not allow for Multi Level Support .

I was easily able to get this to work by altering this code to MongooseAdapter.js

I am not suggesting the following code!, I am just demostrating how easy a simple feature can be added but is instead disregarded.

            queryBuilder.populate(includePaths[0]);
            includePaths.map((it) => it.split(".")).forEach((pathParts) => {
                if (!refPaths.includes(pathParts[0])) {
                    // throw Errors.invalidIncludePath({
                    //     detail: `Resources of type "${type}" don't have a(n) "${pathParts[0]}" relationship.`
                    // });
                }
                if (pathParts.length > 1) {
                    // throw Errors.unsupportedIncludePath({
                    //     detail: `Multi-level include paths like ${pathParts.join('.')} aren't yet supported.`
                    // });
                }
                //populatedPaths.push(pathParts[0]);
                //queryBuilder.populate(pathParts[0]);
            });

Can I suggest a Code Change to allow for this feature ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions