Skip to content

Commit

Permalink
Fix processing of remote contexts with a list
Browse files Browse the repository at this point in the history
Fixes #7
  • Loading branch information
marcelotto committed Aug 19, 2021
1 parent 04de2db commit 1cb520c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/json/ld/context.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions test/unit/context_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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" => %{
Expand Down

0 comments on commit 1cb520c

Please sign in to comment.