Minor fixes to OpenAPI

This commit is contained in:
2026-03-24 13:47:58 +01:00
parent 4233d164c6
commit e433b6aa5c
5 changed files with 21 additions and 8 deletions

View File

@@ -9,6 +9,7 @@
#include <sstream>
#include <vector>
#include "Helpers.h"
#include "../common/GitInfo.h"
#include "../preview/JFJochTIFF.h"
#include "OpenAPIConvert.h"
@@ -108,6 +109,8 @@ std::pair<int, std::string> JFJochBrokerHttp::handleParsingException(const std::
throw;
} catch (const nlohmann::detail::exception &e) {
return {400, e.what()};
} catch (const org::openapitools::server::helpers::ValidationException &e) {
return {400, e.what()};
} catch (const std::exception &e) {
return {500, e.what()};
}
@@ -547,8 +550,6 @@ void JFJochBrokerHttp::statistics_get(const std::optional<bool> &compression, ht
statistics.setZeromqMetadata(Convert(zeromq_metadata));
nlohmann::json j = statistics;
if (!compression.has_value() || compression.value())
response.set_header("Content-Encoding", "deflate");
response.set_content(j.dump(), "application/json");
response.status = 200;
@@ -636,7 +637,7 @@ void JFJochBrokerHttp::image_buffer_image_jpeg_get(const std::optional<int64_t>
int64_t image_id = id.value_or(ImageBuffer::MaxImage);
PreviewImageSettings settings{};
settings.show_user_mask = showUserMask.value_or(true);
settings.show_user_mask = showUserMask.value_or(false);
settings.show_roi = showRoi.value_or(false);
settings.show_spots = showSpots.value_or(true);
settings.saturation_value = saturation;
@@ -819,7 +820,7 @@ void JFJochBrokerHttp::preview_plot_bin_get(const std::optional<std::string> &ty
state_machine.GetPlotRaw(ret, ConvertPlotType(type), roi.value_or(""));
if (ret.empty()) {
response.status = 200;
response.status = 404;
return;
}
@@ -855,9 +856,11 @@ void JFJochBrokerHttp::preview_plot_get(const std::optional<std::string> &type,
};
if (binning) {
if (binning.value() < 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Binning must be positive number or zero");
if (binning.value() < 0) {
response.status = 400;
response.set_content("Binning cannot be negative", "text/plain");
return;
}
req.binning = binning.value();
}

View File

@@ -3163,6 +3163,8 @@ paths:
responses:
"200":
description: All good
"400":
description: Mask is not 4-byte unsigned integer array or empty body
"500":
description: Error within Jungfraujoch code - see output message.
content:
@@ -3247,6 +3249,8 @@ paths:
schema:
type: string
format: binary
"400":
description: Invalid gain level or storage cell number
"404":
description: No calibration recorded so far
/preview/plot:

File diff suppressed because one or more lines are too long

View File

@@ -1991,6 +1991,7 @@ No authorization required
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | All good | - |
**400** | Mask is not 4-byte unsigned integer array or empty body | - |
**500** | Error within Jungfraujoch code - see output message. | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@@ -3273,6 +3274,7 @@ No authorization required
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Calibration image | - |
**400** | Invalid gain level or storage cell number | - |
**404** | No calibration recorded so far | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -901,6 +901,7 @@ export class DefaultService {
body: requestBody,
mediaType: 'application/octet-stream',
errors: {
400: `Mask is not 4-byte unsigned integer array or empty body`,
500: `Error within Jungfraujoch code - see output message.`,
},
});
@@ -985,6 +986,7 @@ export class DefaultService {
'sc': sc,
},
errors: {
400: `Invalid gain level or storage cell number`,
404: `No calibration recorded so far`,
},
});