Skip to content

Allow "$ref" for LDOs #319

Closed
Closed
@handrews

Description

@handrews

It's fairly common links to connect multiple source resources to the same target resource. This often involves a lot of duplication in the LDO, but only the schema keywords can be re-used through "$ref".

This can be annoying when the link is almost entirely the same. In particular, "href" and "hrefSchema" need to match, so they are best re-used in pairs, which is not currently possible.

Since "links" is an array, having a schema consisting of just a "links" array is one re-use option, but only if the desired effect is essentially concatenating the arrays. Tweaking an individual LDO (use case: same "href", "hrefSchema", "targetSchema" and "rel", but applying a different title at each point of use) is somewhere between challenging and impossible.

I propose that we allow "$ref" for an LDO (as elements of the "links" array).

Since keeping track of array positions is a pain, we should add a new "linkDefinitions" keyword, which is an object where each property value is an LDO instead of a schema.


I'm fine with waiting a while to get feedback on draft-06 and see how much this comes up in practice, but it has come up even in some fairly trivial examples I've tried to write recently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions