How row register Option JSON serializer?

Mikhail_Kopylov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2015

I want to create plugin with REST facade which returns List<Option> value.

When executing an exeption is thrown:

org.codehaus.jackson.map.JsonMappingException: No serializer found for class com.atlassian.jira.issue.customfields.option.LazyLoadedOption and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) )

Sure, I can create a class wrapper with fields and use @JsonSerialize annotation with my custom JsonSerializer<Option> class.

But I want register my serializer to the global ObjectMapper to avoid redundant classes creation.

How to?

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Raphael Bossek April 17, 2016

For all who intent to expose an Active Object via REST interface should refer to https://answers.atlassian.com/questions/289164. There seams to be no elegant solution at all.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 16, 2015

You shouldn't generally need to be delving as deep as the LazyLoadedOption stuff - work with the options at that level, not their internals - just get the list of options and let JIRA worry about laziness, databases etc

0 votes
Mikhail_Kopylov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2015

@Nic Brough [Adaptavist], could you help me please? :)

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events