I am creating a Jira software server plugin for v7.13.0. I am creating an API to get all the issue security levels of a user.
my code is not working and is giving the following error:
2022-10-27 16:00:35,623 http-nio-8080-exec-13 ERROR [o.a.c.c.C.[.[localhost].[/].[default]] Servlet.service() for servlet [default] in context with path [] threw exception
org.codehaus.jackson.map.JsonMappingException: No serializer found for class com.atlassian.jira.issue.security.IssueSecurityLevelImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.HashSet[0])
Baeldung article contains examples. Anyway, google it, it’s a very common pattern.
Implementation by @adam.labus is nice and simple, but i think not very scalable, for example if you would like to extend your response with nested objects.
@AlexeyDorofeyev thanks for the reply. yeah, you’re right. But, I think my requirement is for a smaller data set the solution by @adam.labus will work in my case. But, I have also created a DTO pattern for the same also which I will use in another plugin. Thank you so much for the help everyone!