Git Product home page Git Product logo

integration-sdk-java's People

Contributors

david-kumar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

tjayr mallen7

integration-sdk-java's Issues

Error "Unrecognized field messageType" when consuming change notifications

The change notifications json schema seems to have changed since version 1.0.1 of this sdk was released. The json payload returned from Ethos now contains a messageType field that is not included in the com.ellucian.ethos.integration.client.messages.ChangeNotification class model, e.g.:

{
	"id": "..",
	"published": "2023...",
	"resource": {...},
	"operation": "created",
	"contentType": "resource-representation",
	"content": {...},
	"publisher": {...},
	"messageType": "change-notification"
}

This leads to a Jackson exception when trying to deserialize a response consumed with the Ethos messages client:

var apiKey= "xx...";
var client = new EthosClientBuilder();

var messageClient = client.buildEthosMessagesClient();
messageClient.setRegion(SupportedRegions.EUROPE);

var changeNotifications = messageClient.consumeWithLimit(100);
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "messageType" (class com.ellucian.ethos.integration.client.messages.ChangeNotification), not marked as ignorable (7 known properties: "contentType", "operation", "content", "id", "publisher", "published", "resource"])
 at [Source: (StringReader); line: 1, column: 1617] (through reference chain: java.lang.Object[][0]->com.ellucian.ethos.integration.client.messages.ChangeNotification["messageType"])
	at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:1127)
	at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:2036)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1700)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1678)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:320)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
	at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:214)
	at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:24)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4674)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3629)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3597)
	at com.ellucian.ethos.integration.client.messages.ChangeNotificationFactory.createCNListFromJson(ChangeNotificationFactory.java:42)
	at com.ellucian.ethos.integration.client.EthosResponseConverter.toChangeNotificationList(EthosResponseConverter.java:393)
	at com.ellucian.ethos.integration.client.messages.EthosMessagesClient.getMessages(EthosMessagesClient.java:163)
	at com.ellucian.ethos.integration.client.messages.EthosMessagesClient.consumeWithLimit(EthosMessagesClient.java:92)

It would be great to get an updated model(s) released.

A useful enhancement would be to allow a custom Jackson ObjectMapper to be configured via the EthosClientBuilder. Clients could then set DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES or apply custom Mixins for cases where the Ethos implementation and this sdk are out of sync.

var customMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

var builder = new EthosClientBuilder("apikey")
       .withConnectionTimeout(30)
       .withConnectionRequestTimeout(30)
       .withSocketTimeout(30)
       .withObjectMapper(customMapper);

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.