Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Incompatibility with Jackson 2.15.x (as used by Spring Boot 3.1.x) #4777

Open
rvullriede opened this issue Oct 3, 2023 · 2 comments
Open

Comments

@rvullriede
Copy link
Contributor

rvullriede commented Oct 3, 2023

When you use XChange in a Spring Boot 3.1.x project you'll encounter problem with the deserialisation if IOrderFlags. An easy way to reproduce it is to simply upgrade to <version.fasterxml>2.15.2</version.fasterxml> in XChange's parent pom and run the tests.

The first failing tests is:
BinanceAdaptersTest.testFilledMarketOrder:21 » MismatchedInput Unexpected token (VALUE_STRING), expected START_OBJECT: need JSON Object to contain As.WRAPPER_OBJECT type information for class org.knowm.xchange.binance.dto.trade.TimeInForce at [Source: (InputStreamReader); line: 11, column: 20] (through reference chain: org.knowm.xchange.binance.dto.trade.BinanceOrder["timeInForce"]) [ERROR] TradeServiceResilienceTest.shouldSucceedIfFirstCallTimeoutedAndRetryIsEnabled:39 » HttpStatusIO Unexpected token (VALUE_STRING), expected START_OBJECT: need JSON Object to contain As.WRAPPER_OBJECT type information for class org.knowm.xchange.binance.dto.trade.TimeInForce at [Source: (String)"[ { "symbol": "LTCBTC", "orderId": 1, "orderListId": -1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "cummulativeQuoteQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559, "updateTime": 1499827319559, "isWorking": true, "origQuoteOrderQty": "0.000000" }]"; line: 1, column: 236] (through reference chain: java.util.ArrayList[0]->org.knowm.xchange.binance.dto.trade.BinanceOrder["timeInForce"])

I went through Jackson's changelog and found the following issue which might be related: FasterXML/jackson-databind#2968

I couldn't (yet) follow how Jackson is supposed to work in XChange related to type inheritance and didn't find an easy fix for this.
I hope somebody else with deeper knowledge on this might be able to :-)

@rvullriede rvullriede changed the title Incompatibility with Jackson 2.15.x (as used by Spring Boot 3.x) Incompatibility with Jackson 2.15.x (as used by Spring Boot 3.1.x) Oct 4, 2023
@GreurK
Copy link

GreurK commented Oct 31, 2024

Hello,
Do you still have the issue, have you found a workaround ? I'm stuck :'(

@xerikssonx
Copy link

there is code:
@JsonTypeInfo( use = Id.CLASS, include = As.WRAPPER_OBJECT ) public interface IOrderFlags { }
but for enum we receive simple String. Do we really need use = Id.CLASS ? with use = Id.None works good

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants