Skip to content

Commit

Permalink
MAINT-2165 Added new API to retrieve branch metadata only
Browse files Browse the repository at this point in the history
  • Loading branch information
QuyenLy87 committed Apr 19, 2023
1 parent 70d0f92 commit f9adc98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public FilterRegistrationBean<BranchPathUriRewriteFilter> getUrlRewriteFilter()
return new FilterRegistrationBean<>(new BranchPathUriRewriteFilter(
"/branches/(.*)/children",
"/branches/(.*)/parents",
"/branches/(.*)/metadata",
"/branches/(.*)/metadata-upsert",
"/branches/(.*)/actions/.*",
"/branches/(.*)",
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/snomed/snowstorm/rest/BranchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ public Map<String, Object> updateBranchMetadataItems(@PathVariable String branch
return getBranchPojo(branchService.updateMetadata(branch, newMetadata)).getMetadata();
}

@Operation(summary = "Retrieve a single branch metadata")
@GetMapping(value = "/branches/{branch}/metadata")
public Map<String, Object> retrieveBranchMetadata(@PathVariable String branch, @RequestParam(required = false, defaultValue = "false") boolean includeInheritedMetadata) {
branch = BranchPathUriUtil.decodePath(branch);
Branch latestBranch = branchService.findBranchOrThrow(branch, includeInheritedMetadata);
return latestBranch.getMetadata().getAsMap();
}

@Operation(summary = "Retrieve a single branch")
@GetMapping(value = "/branches/{branch}")
public BranchPojo retrieveBranch(@PathVariable String branch, @RequestParam(required = false, defaultValue = "false") boolean includeInheritedMetadata) {
Expand Down

0 comments on commit f9adc98

Please sign in to comment.