Skip to content

JSON-LD 1.1: method to require {"id": "uri"} resource compaction result #507

Closed
@azaroth42

Description

@azaroth42

Issue: The compaction algorithm prefers the most compact format, which for resources without relationships is a string containing the URI. This causes problems in systems that cannot handle arrays of mixed data types (for example ElasticSearch) when there are also resources that have relationships, resulting in both objects and strings in the same array.

For example:

"seeAlso": [
    "http://example.org/reference1",
    {"id": "http://example.org/reference2", "format": "text/html"}
  ]

would raise an error in Elastic.

Proposed solution: Provide a flag to the compaction algorithm to signal that the resulting JSON should always create objects for resources, even if there is only the URI available. This would instead render the example above as an array of objects:

"seeAlso": [
    {"id": "http://example.org/reference1"},
    {"id": "http://example.org/reference2", "format": "text/html"}
  ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    apideferIssue deferred to future Working Group

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions