Skip to content

Importing hierarchical JSON-AD with local-id parents is order dependent #558

@joepio

Description

@joepio

Have a JSON-AD object that references a parent using a local-id, and the parent defined after that:

[
    {
        "https://atomicdata.dev/properties/localId": "child",
        "https://atomicdata.dev/properties/parent": "parent"
    },
    {
        "https://atomicdata.dev/properties/localId": "parent"
    }
]

We get an error:

Unable to import JSON-AD. Unable to parse resource in array. Unauthorized. No parent found for https://atomicdata.dev/importer/3cdk2343yrq/child

This happens, because the parent mentioned does not exist when the first resource is being parsed.

If we invert the order, we're good to go:

[
    {
        "https://atomicdata.dev/properties/localId": "parent"
    },
    {
        "https://atomicdata.dev/properties/localId": "child",
        "https://atomicdata.dev/properties/parent": "parent"
    }
]

How to deal with this

  • Improve error message, instruct users to use a specific import order (first the parents, then the children)
  • Automatically generate referenced parents as empty resources, they'll be overwritten later on automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions