-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object Attributes #1198
base: main
Are you sure you want to change the base?
Object Attributes #1198
Conversation
How are you using this library? Because the convention of turning underscore notation to camelCase should work out of the box, without us having to redefine it everywhere using a This is also covered by Unit Tests here: So I guess that you have a different jackson config (maybe a different ObjectMapper instance). |
When I have deleted the |
I think the configuration is done here:
To configure the ObjectMapper that does the case transformation inside a Quarkus project you need to do this: import javax.enterprise.inject.Instance;
import javax.inject.Singleton;
import org.gitlab4j.api.utils.JacksonJson;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.quarkus.jackson.ObjectMapperCustomizer;
public class ObjectMapperConfiguration {
@Singleton
ObjectMapper objectMapper(Instance<ObjectMapperCustomizer> customizers) {
return new JacksonJson().getObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
}
} I am almost certain other frameworks have similar approaches. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not against having more information in Annotations on the class, to make it independent from a potential Jackson config.
To accept this Pull Request, work is needed:
- add the annotation everywhere needed (not just on few fields) --> consistency is very important
- modify the test so that they run without this specific Jackson config (and they have to stay green).
Hi @jmini , Sorry for the delay! I agree, I think the metadata would be helpful -- I was just tied up during the Thanksgiving holiday here in the U.S. and then some unrelated stuff. I can work through it a bit more here in the coming weeks! I ran into the issue in a spring-boot application I was working through. I did quickly find the spring jackson configuration, however I ran into a somewhat related issue in that some of the event triggers for the webhook used multiple formats of Date/times... This would also be solved potentially with these style annotations. I'll take a broader swing at this! |
…where appropriate
What a work! I will review ASAP and merge. |
Ha, thanks @jmini. I may need another weekend or two to test a bit more. I tried a couple different things with our managed gitlab server and found a couple date formats were wrong -- I'd like to try a test a bunch more! |
@bdgould it could even be that some date in the test JSON files in the |
Yeah, I found a couple of slight issues like that. I'm just trying various things with my managed gitlab instance to verify so far. |
I fixed some more cases where the date is sent as |
I keep getting MergeRequestEvent having a null objectAttributes field. It looks like the API actually uses the syntax: object_attributes. This seems to fix it. There could be other instances of elsewhere in the API.
I'm trying create a simple webhook trigger using a managed GitLab CE 17.5.1 server, and am getting event json like: sample.json