Fix processing of remote contexts with a list

Fixes #7
This commit is contained in:
Marcel Otto 2021-08-19 15:43:59 +02:00
parent 04de2dbe4d
commit 1cb520cb67
3 changed files with 24 additions and 1 deletions

View File

@ -5,6 +5,16 @@ This project adheres to [Semantic Versioning](http://semver.org/) and
[Keep a CHANGELOG](http://keepachangelog.com).
## Unreleased
### Fixed
- remote contexts with a list couldn't be processed correctly (failed with a `JSON.LD.InvalidLocalContextError`)
[Compare v0.3.3...HEAD](https://github.com/rdf-elixir/jsonld-ex/compare/v0.3.3...HEAD)
## 0.3.3 - 2020-10-13
This version mainly upgrades to RDF.ex 0.9.

View File

@ -112,7 +112,7 @@ defmodule JSON.LD.Context do
message: "Invalid remote context: No @context key in #{inspect(document)}"
# 3.2.4) - 3.2.5)
do_update(active, local, remote, options)
update(active, local, remote, options)
end
# 3.4) - 3.8)

View File

@ -150,6 +150,19 @@ defmodule JSON.LD.ContextTest do
end
end
describe "remote contexts" do
test "when the remote context is a list" do
assert context = JSON.LD.context("https://dev.poast.org/schemas/litepub-0.1.jsonld")
assert %{
"Emoji" => "http://joinmastodon.org/ns#Emoji",
# https://www.w3.org/ns/activitystreams
"Accept" => "https://www.w3.org/ns/activitystreams#Accept",
# https://w3id.org/security/v1
"CryptographicKey" => "https://w3id.org/security#Key"
} = iri_mappings(context)
end
end
describe "errors" do
%{
"no @id, @type, or @container" => %{