Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying of multi-instance nested elements generates invalid JSON-LD #941

Open
martinjoconnor opened this issue Aug 3, 2023 · 0 comments

Comments

@martinjoconnor
Copy link
Member

If we have an element that contains a multi-instance element and we make a copy of the nested element in the Metadata Editor then the generated nested element instance does not contain an @id field.

For example, assume we have an element named My Element that contains a nested multi-instance Address element and put My Element in a template as a single instance element:

Screenshot 2023-08-03 at 10 35 08 AM

If we click on the clone icon the make a new Address and then click Save we get the following JSON-LD:

 "Address": [
      {
        "@context": {
          "Address 1": "https://schema.metadatacenter.org/properties/b4be7ce9-bb5d-4633-8e94-d82a49310aa3",
          "Address 2": "https://schema.metadatacenter.org/properties/8edb39e5-92ab-4144-8294-1b7f0bf2b982",
          "City": "https://schema.metadatacenter.org/properties/ed3c76b3-5c48-4ccd-968e-2d44590f37e1"
        },
        "Address 1": {          "@value": "A1"        },
        "Address 2": {          "@value": null        },
        "City": {          "@value": "C1"        },
        "@id": "https://repo.metadatacenter.org/template-element-instances/237f1de4-c0f2-4e19-8204-7e7e0104570b"
      },
      {
        "@context": {
          "Address 1": "https://schema.metadatacenter.org/properties/b4be7ce9-bb5d-4633-8e94-d82a49310aa3",
          "Address 2": "https://schema.metadatacenter.org/properties/8edb39e5-92ab-4144-8294-1b7f0bf2b982",
          "City": "https://schema.metadatacenter.org/properties/ed3c76b3-5c48-4ccd-968e-2d44590f37e1"
        },
        "Address 1": {          "@value": "A1"        },
        "Address 2": {          "@value": null        },
        "City": {          "@value": "C1"        }
      }
    ],

The second Address instance does not have an @id, which is invalid.

Oddly, we can still save the instance. However, when we attempt to copy this instance in the desktop the copy fails with a validation error because of the missing @id

Also, this does not happen with a single level of nesting, e.g., if the Address element is directly placed as a multi-instance element at the top level of the template.

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

No branches or pull requests

2 participants