kontent-ai / kontent-ai/java-packages

Strongly Typed Content Item Converter does not support mapping name from an Option

Open
#23 6 comments 0 reactions 0 assignees View on GitHub
enhancement groomed hacktoberfest help wanted up-for-grabs
Dominant language
Java
Stars
17
Forks
27
PR merge metrics
No merged PRs in 30d

Description

### Motivation

When rendering a multiple choice elements in a strongly typed model, one must access the `List value` property of the [MultipleChoiceElement](https://github.com/Kentico/delivery-sdk-java/blob/master/delivery/src/main/java/com/kenticocloud/delivery/MultipleChoiceElement.java) class, which might be tedious. There should be a more straightforward path to the names of options.

One potential way to handle this would be like the following:
```java
@ContentItemMapping("product")
public class Product {
@ElementMapping("product_categories")
List productCategories;

//New feature
@ElementMappingOption(elementCodeName = "product_categories", optionCodeName = "footwear")
Boolean isFootwear;
}
```

### Original description

If an [Option](https://github.com/Kentico/delivery-sdk-java/blob/master/delivery/src/main/java/com/kenticocloud/delivery/Option.java) is mapped to a field, the name from the option should be used.

Contributor guide

Open the contributing guide

Research direction

Start by reading MultipleChoiceElement.java and Option.java, then locate the strongly typed content item converter and its existing element-mapping tests. Verify how an Option is currently assigned to a field and define the expected name mapping for the proposed annotation; done means the example mapping works and existing conversion behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.