gitlab4j-api icon indicating copy to clipboard operation
gitlab4j-api copied to clipboard

Not Deserializing Snake Case Properties when used in Jenkins Plugin

Open krische opened this issue 3 years ago • 1 comments

I am using this library in a Jenkins plugin, and I am noticing some strange behavior.

After updating some other plugins to their newest versions (jackson2-api to 2.13.1 and jersey2-api to 2.35), I noticed that this library no longer deserializes correctly. Any model property that uses snake_case in it's JSON does not get deserialized to the camelCase Java object properties. Those Java object properties just have null values. The properties that match exactly between JSON and Java (e.g. description) seem to work perfectly fine.

I have no idea in the slightest as to what is going on. Is it something to do with this library and having newer versions of jersey in the classpath? Or maybe am I just missing some dependency?

Any guidance would be greatly appreciated.

krische avatar Jan 29 '22 00:01 krische

@krische I don't know if your problem is the same as mine (gitlab-branch-source plugin that uses the gitlab-api plugin (wrapper of gitlab4j-api), but yes I definitely have problem if jersey2-api is installed in jenkins.

I've opened 3 PRs to fix the problem:

https://github.com/gitlab4j/gitlab4j-api/pull/795 https://github.com/jenkinsci/jersey2-api-plugin/pull/9 https://github.com/jenkinsci/gitlab-api-plugin/pull/7

If you can, install the snapshot plugins (or rebuild from source) and it should fix your problem:

https://github.com/jenkinsci/gitlab-api-plugin/pull/7#issuecomment-1036209830

If you were packaging gitlab4j-api in your own plugin, then maybe you could use the gitlab-api jenkins plugin instead.

Either way if you can try them let me know if you encounter problems or if they work for you.

dcendents avatar Feb 11 '22 18:02 dcendents