-
Notifications
You must be signed in to change notification settings - Fork 203
Closed
Description
Given the following data-structure containing cyclic dependencies:
var jsonld = require('jsonld');
var a = {
"@context": {"@vocab": "http://schema.org"},
"@id": "http://example.com/a",
hasPart: []
}
var b = {
"@context": {"@vocab": "http://schema.org"},
"@id": "http://example.com/b",
isPartOf: []
}
a.hasPart.push(b);
b.isPartOf.push(a);
jsonld.flatten(a);
I get the following RangeError
:
/tmp/node_modules/jsonld/js/jsonld.js:5836
return (Object.prototype.toString.call(v) === '[object Object]');
^
RangeError: Maximum call stack size exceeded
Instead I'd expect the following output:
{
"@context": {
"@vocab": "http://schema.org/"
},
"@graph": [
{
"@id": "http://example.com/a",
"hasPart": {
"@id": "http://example.com/b"
}
},
{
"@id": "http://example.com/b",
"isPartOf": {
"@id": "http://example.com/a"
}
}
]
}
I see the same behavior in pyld
, so I'm not sure whether this is an implementation problem or an issue with the API spec.
Metadata
Metadata
Assignees
Labels
No labels