stil4m / mollie-api

Mollie API for Java
14 stars 14 forks source link

Should the object mapper be more forgiving? #25

Closed stil4m closed 7 years ago

stil4m commented 7 years ago

Deserialization fails when unrecognised fields are added to the API. Now we notice this directly in the nightly build. But when you use the Api in production it would be nice that the added fields are just ignored.

An approach would be to:

Any ideas on this?

tubbynl commented 7 years ago

in my opinion the adding of new fields in the API should not result in breaking existing production deployments of the mollie-client so i prefer making the default object mapper more forgiving and having a nightly build running a strict object mapper would be nice to detect api changes early

but if the latter happens really often it might backfire on it's purpose

maybe @jcassee also has a view on this

tubbynl commented 7 years ago

Daamvm (from Mollie) in #23

You're right stil4m, the resource attribute is only added for payments which have an API customer. We wanted to make the endpoints more consistent by adding the resource attribute to each response. We didn't want to break existing implementations, so that's why wo only added it to payments with a customer.

I can imagine it's confusing the way it's right now. I'll report it internally, we can at least update the docs.

Further would I recommend ignoring unknown fields from our API. We might occasionally add new fields, for example to the payment details object for new payment types. Note that it will never be backwards incompatible when you ignore the unknown fields.

stil4m commented 7 years ago

Fixed with #29