question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Links are ignored during deserialization

See original GitHub issue

the default simplePropertyMappers does not work with pagination when body contains link

example…

{
  "meta": {
    "totalPages": 13
  },
  "data": [
    {
      "type": "articles",
      "id": "3",
      "attributes": {
        "title": "JSON:API paints my bikeshed!",
        "body": "The shortest article. Ever.",
        "created": "2015-05-22T14:56:29.000Z",
        "updated": "2015-05-22T14:56:28.000Z"
      }
    }
  ],
  "links": {
    "self": "http://example.com/articles?page[number]=3&page[size]=1",
    "first": "http://example.com/articles?page[number]=1&page[size]=1",
    "prev": "http://example.com/articles?page[number]=2&page[size]=1",
    "next": "http://example.com/articles?page[number]=4&page[size]=1",
    "last": "http://example.com/articles?page[number]=13&page[size]=1"
  }
}

when deserialized, will be

[ { type: 'articles',
    id: '3',
    title: 'JSON:API paints my bikeshed!',
    body: 'The shortest article. Ever.',
    created: '2015-05-22T14:56:29.000Z',
    updated: '2015-05-22T14:56:28.000Z' } ]

I see that setLinks exists on the simplePropertyMapper here

but it seems that only links inside data will be checked, but not the body.links ( which is where links will exist if it’s for pagination )

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
olosegrescommented, Sep 13, 2019

@konovalov-nk I use “stuff” to show that it is not “data” from json, in the code they are found nearby

0reactions
olosegrescommented, Sep 14, 2019

Jsona is a tool to simplify the work with standardized data. Everything inside the meta is not standardized and jsona cannot take into account all the special cases. Thus, everything that is not standardized will look a bit hacky, I think this is normal.

But if you see a way to make jsona better, then welcome, we can consider your PRs 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring property when deserializing - java - Stack Overflow
My problem is that I want to serialize the money property but ignore while deserializing it i.e., dont accept any values from the...
Read more >
Ignore property during deserialization but retain in ... - GitHub
What I'm seeing is @JsonIgnoreProperties({"zip"}) seems to cause property zip to not be required during deserialization (desired), but also ...
Read more >
Deserialized JSON with Invalid Ids are ignored silently
Deserialized JSON with Invalid Ids are ignored silently ... a question: why are your clients randomly returning non-Id values in Id fields?
Read more >
XmlAttributes.XmlIgnore Property (System.Xml.Serialization)
Gets or sets a value that specifies whether or not the XmlSerializer serializes a public field or public read/write property.
Read more >
Gson User Guide - Google Sites
Fields corresponding to the outer classes in inner classes, anonymous classes, and local classes are ignored and not included in serialization or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found