Coder Social home page Coder Social logo

jsonapiary's People

Contributors

dependabot[bot] avatar loganleyva avatar mattmessinger avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonapiary's Issues

Tests fail under Windows

Unfortunately under Windows I have the different line endings \r\n instead of \n. As long as the tests directly compare against Strings this causes issue.

Not sure what the cleanest approach is. Simplest would be to replace all \r\n with \n.

JSON Deserialization of 2..n objects without an ID gets weird results

Hey, me again. I discovered some behavior I think it is worth to discuss.

We have the following use case:

think of an customer API endpoint to create customers. E.g.
POST api/customers

where a list of customers can be given in as body, e.g.:
{
"data": [
{
"type": "customer",
"attributes": {
"name": "Best Customer",
"age": 40,
"someother": "value"
}
},
{
"type": "customer",
"attributes": {
"name": "Best Customer2",
"age": 80,
"someother": "cool!"
}
}
]
}

Note: There is no ID in one of these objects because they need to be created.

Now the behavior is, that after JsonApiAiry with Jackson deserializes the JSON shown above to an Java List with 2 identical objects. The ID of both is, as expected, null, but the attributes are equal, and the attributes section of the second new customer gets ignored/forgotten.

Why is that so?

@JsonUnwrapped is ignored

@JsonUnwrapped is a Jackson annotation that "flattens" the attributes of an inner variable and puts all key/values into the current level of the json body.

The @JsonUnwrapped payload is not taken into account by JsonApiary. I tested and debugged around. The ObjectMapper treats it correctly (even with Jsonapiary module loaded) if not wrapped in a JsonApiEnvelope. But as soon as an object gets wrapped in JsonApiEnvelop the unwrapping no longer happens.

Unfortunately this goes beyond my knowledge of Jackson. My gut feeling after debugging tells me that JsonApiary code calls a layer of Jackson where the unwrapping already should have happened and that the JsonApiaryModule calls the wrong method.

Tests are failing on master branch

Hello,

when I clone the master branch and execute a maven test ; there are failled tests. Can you have a look?

Failing tests are:
loopConstructonTest
complexRelationshipSerializationTest

Thank you!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.