-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Labels
Milestone
Description
I am currently trying to upgrade pyld to version 2.0.x. But sadly some of our test cases fail and I think thats due to an Bug in pyld.
The problem seems to be an empty {} as part of the context. Lets have a little example:
payload = {
"id": "https://noop/federation/actors/demo",
"outbox": "https://noop/federation/actors/demo/outbox",
"inbox": "https://noop/federation/actors/demo/inbox",
"preferredUsername": "demo",
"type": "Person",
"name": "demo",
"followers": "https://noop/federation/actors/demo/followers",
"following": "https://noop/federation/actors/demo/following",
"manuallyApprovesFollowers": False,
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{}
],
"endpoints": {"sharedInbox": "https://noop/federation/shared/inbox"},
}
print(jsonld.expand(payload))The result of this is a simple []. I verified the same code with the JSON-LD Playground and there the result is, as I would expect:
[
{
"https://www.w3.org/ns/activitystreams#endpoints": [
{
"https://www.w3.org/ns/activitystreams#sharedInbox": [
{
"@id": "https://noop/federation/shared/inbox"
}
]
}
],
"https://www.w3.org/ns/activitystreams#followers": [
{
"@id": "https://noop/federation/actors/demo/followers"
}
],
"https://www.w3.org/ns/activitystreams#following": [
{
"@id": "https://noop/federation/actors/demo/following"
}
],
"@id": "https://noop/federation/actors/demo",
"http://www.w3.org/ns/ldp#inbox": [
{
"@id": "https://noop/federation/actors/demo/inbox"
}
],
"_:manuallyApprovesFollowers": [
{
"@value": "False"
}
],
"https://www.w3.org/ns/activitystreams#name": [
{
"@value": "demo"
}
],
"https://www.w3.org/ns/activitystreams#outbox": [
{
"@id": "https://noop/federation/actors/demo/outbox"
}
],
"https://www.w3.org/ns/activitystreams#preferredUsername": [
{
"@value": "demo"
}
],
"@type": [
"https://www.w3.org/ns/activitystreams#Person"
]
}
]
So I tested the same expansion with pyld but without the empty list as part of the context, and the result is as expected:
[
{
"https://www.w3.org/ns/activitystreams#endpoints": [
{
"https://www.w3.org/ns/activitystreams#sharedInbox": [
{
"@id": "https://noop/federation/shared/inbox"
}
]
}
],
"https://www.w3.org/ns/activitystreams#followers": [
{
"@id": "https://noop/federation/actors/demo/followers"
}
],
"https://www.w3.org/ns/activitystreams#following": [
{
"@id": "https://noop/federation/actors/demo/following"
}
],
"@id": "https://noop/federation/actors/demo",
"http://www.w3.org/ns/ldp#inbox": [
{
"@id": "https://noop/federation/actors/demo/inbox"
}
],
"_:manuallyApprovesFollowers": [
{
"@value": false
}
],
"https://www.w3.org/ns/activitystreams#name": [
{
"@value": "demo"
}
],
"https://www.w3.org/ns/activitystreams#outbox": [
{
"@id": "https://noop/federation/actors/demo/outbox"
}
],
"https://www.w3.org/ns/activitystreams#preferredUsername": [
{
"@value": "demo"
}
],
"@type": [
"https://www.w3.org/ns/activitystreams#Person"
]
}
]
Reactions are currently unavailable