|
1 | 1 | package com.octopus.openfeature.provider; |
2 | 2 |
|
3 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; |
| 4 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; |
| 6 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
5 | 7 |
|
6 | 8 | import java.util.ArrayList; |
7 | 9 | import java.util.List; |
8 | 10 | import java.util.Map; |
9 | 11 |
|
| 12 | +@JsonIgnoreProperties(ignoreUnknown = true) |
10 | 13 | class FeatureToggleEvaluation { |
11 | 14 | private final String name; |
12 | 15 | private final String slug; |
13 | 16 | private final boolean isEnabled; |
14 | 17 | private final List<Map.Entry<String, String>> segments; |
15 | 18 |
|
16 | 19 | @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) |
17 | | - FeatureToggleEvaluation(@JsonProperty("name") String name, @JsonProperty("slug")String slug, @JsonProperty("isEnabled") boolean isEnabled, |
18 | | - @JsonProperty("segments") List<Map.Entry<String, String>> segments) { |
| 20 | + FeatureToggleEvaluation( |
| 21 | + @JsonProperty("name") String name, |
| 22 | + @JsonProperty("slug") String slug, |
| 23 | + @JsonProperty("isEnabled") boolean isEnabled, |
| 24 | + @JsonDeserialize(contentUsing = SegmentDeserializer.class) @JsonProperty("segments") List<Map.Entry<String, String>> segments |
| 25 | + ) { |
19 | 26 | this.name = name; |
20 | 27 | this.slug = slug; |
21 | 28 | this.isEnabled = isEnabled; |
22 | | - |
| 29 | + |
23 | 30 | this.segments = new ArrayList<>(); |
24 | 31 | if (segments != null) { |
25 | 32 | this.segments.addAll(segments); |
|
0 commit comments