Skip to content

Commit

Permalink
Expose contextids to clients
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarvelle committed Dec 2, 2024
1 parent 1c60023 commit b023d17
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/no/ndla/taxonomy/service/dtos/NodeDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public class NodeDTO {
@Schema(description = "A list of all contexts this node is part of")
private List<TaxonomyContextDTO> contexts = new ArrayList<>();

@JsonProperty
@Schema(description = "A list of all contextids this node has ever had")
private Set<String> contextids = new HashSet<>();

@JsonProperty
@Schema(description = "The context object selected when fetching node")
private Optional<TaxonomyContextDTO> context = Optional.empty();
Expand Down Expand Up @@ -144,6 +148,7 @@ public NodeDTO(
.collect(Collectors.toCollection(TreeSet::new));

this.nodeType = entity.getNodeType();
this.contextids = entity.getContextIds();

Optional<TaxonomyContext> selected = entity.pickContext(contextId, parent, root, filteredContexts);
selected.ifPresent(ctx -> {
Expand Down

0 comments on commit b023d17

Please sign in to comment.