Skip to content

Support merging user-provided JSON-LD frame with built-in default #313

@ddeboer

Description

@ddeboer

Problem

When using docgen from-shacl -f frame.jsonld, the user must provide a complete JSON-LD frame that duplicates all of docgen's built-in defaults (e.g. targetClass, datatype, path, severity type coercions) plus their own custom properties.

This means:

  • If docgen updates its default frame, consumers' custom frames silently become out of sync.
  • Users must understand docgen's internal framing requirements just to add a single custom property.

For example, in dataset-register we only need to add two custom properties (nde:futureChange, nde:version) but have to maintain a full copy of the default frame to do so: shacl.frame.jsonld.

Proposal

Have docgen deep-merge a user-supplied frame with its built-in default frame before calling jsonld.frame(). This way the -f flag provides additions to the default rather than a full replacement.

A user's frame would then only need the custom parts:

{
  "@context": {
    "nde": "https://def.nde.nl#",
    "nde:futureChange": {},
    "nde:version": {}
  }
}

Since JSON-LD framing only accepts a single frame object, the composition must happen at the application level — which makes docgen the natural place for it.

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