Skip to content

Add v2 check for additional entries not mapped to a JSON-LD context #32

@kimdhamilton

Description

@kimdhamilton

In V2 we are tightening verification and check for added values not mapped to JSON-LD. This is done by adding a fallback context and determining if any fields were added. This is done in other projects, but the swift jsonld libraries are unclear. Needs more time/investigation, so opening an issue to track.

Starting code here, but didn't get far.

guard let currentContext = json["@context"] as? [AnyObject] else {
    self.state = .failure(reason: "Failed JSON-LD normalization; could not find @context")
    return
}
let fallbackContext : [String: Any] = [
    "@vocab": "http://fallback.org/"
]
var newContext = Array(currentContext)
newContext.append(fallbackContext as AnyObject)
json["@context"] = newContext

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