Comments (12)
definitely a defect, introduced by recent fix. I'll have a look, thanks!
from odata-client.
Ah wait, this is not the response from the graph service but what happens when you serialize a User
object? How do you serialize it? In a recent fix I did remove an annotation from entity objects so that you will now have to instruct the serializer to exclude nulls. Serializer.INSTANCE
does this by default:
User user = User.builderUser().id("12345").build();
System.out.println(Serializer.INSTANCE.serialize(user));
output:
{"@odata.type":"microsoft.graph.user","id":"12345"}
from odata-client.
How do you serialize it?
Serializing it using Spring Webflux -
ServerResponse.ok().contentType(MediaType.APPLICATION_STREAM_JSON).body(this.service.listUsers(), User.class)
where listUsers return Flux<Stream<odata.msgraph.client.entity.User>>
The above sample I had posted using v0.1.12 and v0.1.17 was using the same code.
from odata-client.
Entity objects used to have a class level annotation @JsonInclude(Include.NON_NULL)
which was friendly for your use case. I removed that annotation because it was breaking a scenario where we do want to serialize some or all nulls (updating fields to null in a patch).
So if you are serializing it using Spring Webflux then just configure Webflux to exclude nulls. I found lots of information when I googled "webflux customize json serialization"
from odata-client.
I'll have a look at returning the class level annotation but I doubt that I can override it (which I need to do). So no promises!
from odata-client.
Ah yes, I can override the class level annotation. So don't worry about customizing your serializer, I'll change all generated objects to have @JsonInclude(Include.NON_NULL)
again.
from odata-client.
Trying to do this I think I've encountered Jackson bugs in relation to setting the AnnotationInspector. I've got a workaround but feels like I've opened a Pandora's box of more detective work!
from odata-client.
The change you want is in release 0.1.20 on Maven Central now.
from odata-client.
By the way we can probably get the default serialization to suppress including empty arrays as well. I'll have to make sure it doesn't have any nasty side-effects though.
from odata-client.
I think this is done so closing. Reopen if you need to.
from odata-client.
I think this is done so closing. Reopen if you need to.
Validated the fix, it's working as expected. Thanks.
By the way we can probably get the default serialization to suppress including empty arrays as well. I'll have to make sure it doesn't have any nasty side-effects though.
Can you give me some pointers? Which Jackson class should I be extending?
from odata-client.
Validated the fix, it's working as expected. Thanks.
Good to hear.
By the way we can probably get the default serialization to suppress including empty arrays as well. I'll have to make sure it doesn't have any nasty side-effects though.
Can you give me some pointers? Which Jackson class should I be extending?
I would just replace the @JsonInclude(Include.NON_NULL)
annotation at the top of all entities, complex types, collectionPage with @JsonInclude(Include.NON_EMPTY)
.
from odata-client.
Related Issues (20)
- NPE when running odata-client-maven-plugin through Java 11 HOT 10
- Batch requests? HOT 6
- Create client for Graph v1.0 behind a proxy doesn't work HOT 6
- How to get partial range of content of a drive item(file) HOT 9
- DriveItem does not have the @microsoft.graph.downloadUrl property HOT 6
- Issue with Microsoft Dynamics EntityDefinitions/RelationshipDefinitions HOT 2
- Onedrive delta link, does not give top(2), but gives all changes though top is added HOT 3
- [Documentation] Authentication with OData Service HOT 7
- Cannot deserialize UnsignedByte using Serializer.deserialize HOT 5
- upload file to onedrive through createUploadSession - itemWithPath() not found HOT 4
- httpResponse of odata.client.HttpResponse put(String s, .List<RequestHeader> list, InputStream inputStream, int i,HttpRequestOptions httpRequestOptions) does not give reponse body in httpResponse.getText() as post() method gives. HOT 8
- odata\client\TestingService.class- not returning response body for patchOrPut() method. HOT 17
- post() now does a HTTP PUT HOT 4
- HttpPatch Delta<T> parameter is always Null HOT 1
- odata-client-runtime dependency on jaxb-core and jaxb-impl HOT 2
- Unable to generate a client with dynamics finance and operations metadata HOT 10
- Support "Evolvable Enumerations" with a default value HOT 5
- Hit java reserved identifier 'package' HOT 5
- Automatic mapping of "expanded" objects support? HOT 4
- Requesting an individual resource - request produced using path parameter instead of ID in brackets encoded in URL HOT 2
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 odata-client.