@POST
@Path("migrate/{id}/{configurationVersion}")
@Operation(description = "Allows to migrate a component configuration without calling any component execution.")
@APIResponse(responseCode = "200",
description = "the new configuration for that component (or the same if no migration was needed).",
content = @Content(mediaType = APPLICATION_JSON))
@APIResponse(responseCode = "404", description = "The component is not found",
content = @Content(mediaType = APPLICATION_JSON,
schema = @Schema(type = OBJECT, implementation = ErrorPayload.class)))
public Map<String, String>
migrate(@PathParam("id") @Parameter(name = "id", description = "the component identifier",
in = PATH) final String id,
@PathParam("configurationVersion") @Parameter(name = "configurationVersion",
description = "the configuration version you send", in = PATH) final int version,
@RequestBody(description = "the actual configuration in key/value form.", required = true,
content = @Content(mediaType = APPLICATION_JSON,
schema = @Schema(type = OBJECT))) final Map<String, String> config) {
return ofNullable(componentDao.findById(id))
.orElseThrow(() -> new WebApplicationException(Response
.status(Response.Status.NOT_FOUND)
.entity(new ErrorPayload(ErrorDictionary.COMPONENT_MISSING, "Didn't find component " + id))
.build()))
.getMigrationHandler()
.migrate(version, config);
}