Skip to content

Commit

Permalink
create ResponseMapStringString class to be used in @Schema to define …
Browse files Browse the repository at this point in the history
…HashMap<String, String>
  • Loading branch information
ianwallen committed Jan 3, 2024
1 parent 57f7e8d commit 71aae04
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,30 @@ public void deleteTranslations(
}


// Class used by getDbTranslations to define schema being returned.
// Based on https://github.com/swagger-api/swagger-core/issues/3724#issuecomment-718761089
private class ResponseMapStringString extends HashMap<String, String>

This comment has been minimized.

Copy link
@josegar74

josegar74 Jan 15, 2024

I would use another name: ResponseMapDbTranslations, I thinks would be more clear.

{
private static final long serialVersionUID = 6453256719377446479L;
}

@io.swagger.v3.oas.annotations.Operation(
summary = "List database translations (used to overrides client application translations).")
@GetMapping(value = "/db/translations",
produces = {
MediaType.APPLICATION_JSON_VALUE
})
@ApiResponse(
responseCode = "200",
content = @Content(mediaType = "application/json", examples = {
@ExampleObject(value =
"{" +
" \"translationKey1\": \"Translated Key One\",\n" +
" \"translationKey2\": \"Translated Key Two\",\n" +
" \"translationKey3\": \"Translated Key Tree\"\n" +
"}")
}, schema = @Schema(implementation = ResponseMapStringString.class))
)
@ResponseStatus(OK)
@ResponseBody
public Map<String, String> getDbTranslations(
Expand Down

0 comments on commit 71aae04

Please sign in to comment.