Skip to content

Additional restriction to @sealed term clearing #136

Closed
@dlongley

Description

@dlongley

We've completed a preliminary implementation of @sealed terms here:

digitalbazaar/jsonld.js#289

Our implementation:

  • Allows terms to be sealed using "@sealed": true in a term definition (or not sealed with "@sealed": false)
  • Allows setting the default "@sealed" for all terms in an @context via "@sealed": true at the top level
  • Does not affect existing term clearing rules when there are no @sealed terms
  • Allows clearing @sealed terms ONLY via a new property term definition with a scoped @context (note: and the new term does not need to be sealed)

Note that the last item is a slight tweak (additional restriction) on what is in the spec. We believe this approach better matches the use cases and expectations of the target audience for JSON-only application developers. The high-level idea is that a @sealed term is assured to maintain its meaning unless cleared by a new term (with a scoped context) that creates a new branch in the JSON tree.

This approach:

  • Provides sufficient assurance for the meaning of @sealed terms without a need for JSON-LD processing: a JSON-only dev can read a spec and write safe code that traverses JSON-LD data via @sealed terms ... without a need for JSON-LD processing, instead using only validation rules (e.g. json-schema)
  • Allows extensions to the JSON tree to occur safely in an idiomatic way where @sealed terms can only be cleared under new branches in the JSON tree (matches common JSON developer intuitions/expectations)
  • Very closely mirrors what @pchampin articulated so well a while back but has the added benefit of being simpler to implement: there is no need to track the @context from whence @sealed terms came

We'd like to see the spec updated to restrict clearing @sealed terms in the way articulated here and implemented in the above link. This approach seems to fully address the original need for the feature and has a simple implementation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions