Skip to content

Commit

Permalink
[extension-azure] Fix JSON serialization of Azure inner objects
Browse files Browse the repository at this point in the history
  • Loading branch information
valfirst committed Oct 20, 2021
1 parent 1e10666 commit 77e053e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion vividus-extension-azure/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project.description = 'Vividus extension for Azure Cloud'

dependencies {
api(group: 'com.azure', name: 'azure-identity', version: '1.3.6')
api(group: 'com.azure', name: 'azure-identity', version: '1.4.0')

testImplementation platform(group: 'org.junit', name: 'junit-bom', version: versions.junit)
testImplementation(group: 'org.junit.jupiter', name: 'junit-jupiter')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@

import com.azure.core.util.serializer.JacksonAdapter;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;

public class InnersJacksonAdapter extends JacksonAdapter
{
private ObjectMapper objectMapper;

@Override
protected ObjectMapper simpleMapper()
public InnersJacksonAdapter()
{
if (this.objectMapper == null)
{
super((outer, inner) -> {
JacksonAnnotationIntrospector annotationIntrospector = new JacksonAnnotationIntrospector()
{
@Override
Expand All @@ -40,8 +35,8 @@ public Access findPropertyAccess(Annotated annotated)
return access == Access.WRITE_ONLY ? Access.AUTO : access;
}
};
this.objectMapper = super.simpleMapper().setAnnotationIntrospector(annotationIntrospector);
}
return objectMapper;
outer.setAnnotationIntrospector(annotationIntrospector);
inner.setAnnotationIntrospector(annotationIntrospector);
});
}
}

0 comments on commit 77e053e

Please sign in to comment.