[REST] Check a label is provided when creating a new semantic tag (#3734)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>pull/3761/head
parent
aef57edd73
commit
5f8658d0ae
|
@ -189,16 +189,19 @@ public class TagResource implements RESTResource {
|
|||
@Operation(operationId = "createSemanticTag", summary = "Creates a new semantic tag and adds it to the registry.", security = {
|
||||
@SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = {
|
||||
@ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = EnrichedSemanticTagDTO.class))),
|
||||
@ApiResponse(responseCode = "400", description = "The tag identifier is invalid."),
|
||||
@ApiResponse(responseCode = "400", description = "The tag identifier is invalid or the tag label is missing."),
|
||||
@ApiResponse(responseCode = "409", description = "A tag with the same identifier already exists.") })
|
||||
public Response create(
|
||||
@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
|
||||
@Parameter(description = "tag data", required = true) EnrichedSemanticTagDTO data) {
|
||||
final Locale locale = localeService.getLocale(language);
|
||||
|
||||
if (data.uid == null) {
|
||||
if (data.uid == null || data.uid.isBlank()) {
|
||||
return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Tag identifier is required!");
|
||||
}
|
||||
if (data.label == null || data.label.isBlank()) {
|
||||
return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Tag label is required!");
|
||||
}
|
||||
|
||||
String uid = data.uid.trim();
|
||||
|
||||
|
|
Loading…
Reference in New Issue