Comments (6)
@akadlec
That 'if' added because of the bug, see #17
Earlier, if one entity figured in relationships multiple times, jsona didn't process it's meta & links each time, only ones, but meta may be different
from jsona.
ok so this bug fix added bug and fix :] I made a autopatch so right now I am safe for now
from jsona.
@akadlec
Can you provide example of data (json), that causes the error?
from jsona.
Hi @olosegres I have this same error. Here is sample json:
var Jsona = require("jsona").Jsona;
const f = new Jsona();
const json = {
data: {
type: 'foo',
id: '1',
attributes: {
created: '2018-08-29T10:24:07.831695-07:00',
modified: '2018-08-29T10:24:07.831726-07:00'
},
relationships: {
distribution_models: {
data: [
{
type: 'distribution_models',
id: '2'
},
{
type: 'distribution_models',
id: '1'
}
],
meta: {
count: 2
}
},
scan_plans: {
data: [
{
type: 'scan_plans',
id: '1'
}
],
meta: {
count: 1
}
},
guidance: {
data: null
},
children: {
data: [],
meta: {
count: 0
}
}
}
},
included: [
{
type: 'distribution_channels',
id: '1',
attributes: {
created: '2018-09-05T11:42:54.768966-07:00',
modified: '2018-09-05T11:42:54.769021-07:00',
name: 'derpy'
}
},
{
type: 'distribution_formats',
id: '1',
attributes: {
created: '2018-09-05T11:42:44.240765-07:00',
modified: '2018-09-05T11:42:44.240807-07:00',
name: 'baz'
}
},
{
type: 'distribution_licenses',
id: '1',
attributes: {
created: '2018-09-05T11:42:24.154227-07:00',
modified: '2018-09-05T11:42:24.154297-07:00',
name: 'foo bar'
}
},
{
type: 'distribution_models',
id: '1',
attributes: {
created: '2018-09-05T11:43:42.982340-07:00',
modified: '2018-09-05T11:43:42.982497-07:00',
name: 'DM foo',
intended_recipients: 'dudes'
},
relationships: {
channel: {
data: {
type: 'distribution_channels',
id: '1'
}
},
outbound_licenses: {
data: [
{
type: 'distribution_licenses',
id: '1'
}
],
meta: {
count: 1
}
},
format: {
data: {
type: 'distribution_formats',
id: '1'
}
},
dossier: {
data: {
type: 'dossiers',
id: '1'
}
}
}
},
{
type: 'distribution_models',
id: '2',
attributes: {
created: '2018-09-05T21:04:59.600630-07:00',
modified: '2018-09-05T21:04:59.600677-07:00',
name: 'derp2',
intended_recipients: 'asdf,asd'
},
relationships: {
channel: {
data: {
type: 'distribution_channels',
id: '1'
}
},
outbound_licenses: {
data: [
{
type: 'distribution_licenses',
id: '1'
}
],
meta: {
count: 1
}
},
format: {
data: {
type: 'distribution_formats',
id: '1'
}
},
dossier: {
data: {
type: 'dossiers',
id: '1'
}
}
}
},
{
type: 'scan_plans',
id: '1',
attributes: {
created: '2018-09-05T21:38:29.402500-07:00',
modified: '2018-09-05T21:38:29.402543-07:00'
},
relationships: {
source_locations: {
data: [
{
type: 'source_locations',
id: '2'
},
{
type: 'source_locations',
id: '1'
}
],
meta: {
count: 2
}
},
dossier: {
data: {
type: 'dossiers',
id: '1'
}
}
}
},
{
type: 'source_locations',
id: '1',
attributes: {
created: '2018-09-05T21:38:47.154435-07:00',
modified: '2018-09-05T21:38:47.154477-07:00'
},
relationships: {
scan_plan: {
data: {
type: 'scan_plans',
id: '1'
}
}
}
},
{
type: 'source_locations',
id: '2',
attributes: {
created: '2018-09-05T21:42:42.023320-07:00',
modified: '2018-09-05T21:42:42.023363-07:00'
},
relationships: {
scan_plan: {
data: {
type: 'scan_plans',
id: '1'
}
}
}
}
]
};
console.log(f.deserialize(json))
from jsona.
FYI including source_locations
is what causes it. If I remove it, it works.
from jsona.
Can confirm that downgrading to 1.1.10 fixes the issue for the time being.
from jsona.
Related Issues (20)
- Browsers support HOT 1
- Deserialize `snake_case` to `camelCase` HOT 1
- switchChar meta to camelCased HOT 1
- Infinately nested relationships HOT 1
- Custom ModelsSerializer HOT 9
- Unclear how to change to camelCase HOT 1
- Keep relationship links when deserializing HOT 1
- `meta` property in relationship is dropped when deserializing HOT 10
- Cannot find module 'Jsona HOT 1
- Property 'next' does not exist on type 'TJsonApiBody' HOT 1
- Source map issue? HOT 3
- Switching nested attribute object keys to camel case is not working HOT 1
- Bug in deserialize: "included resources" data takes priority over "primary data" HOT 1
- When serializing with includeNames, only the first element of array is included in the resulting body if elements don't have id HOT 1
- RangeError: Maximum call stack size exceeded with jsona 1.10.1 not on older releases HOT 2
- Nested json api object is not properly deserilized HOT 1
- Circular structure jsonapi breaks deserializer HOT 3
- How to deserialize duplicate id without having duplicate result? HOT 1
- Incompatible with react-query HOT 4
- Error when using Jsona on Nuxt server side
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsona.