OpenAPI: Make current_counter optional for compatibility with prior versions

This commit is contained in:
2025-12-12 09:51:19 +01:00
parent 45ead8a4ad
commit a67909efd5
7 changed files with 29 additions and 11 deletions

View File

@@ -26,6 +26,7 @@ Image_buffer_status::Image_buffer_status()
m_Total_slots = 0L;
m_Available_slots = 0L;
m_Current_counter = 0L;
m_Current_counterIsSet = false;
}
@@ -121,8 +122,8 @@ bool Image_buffer_status::operator==(const Image_buffer_status& rhs) const
(getAvailableSlots() == rhs.getAvailableSlots())
&&
(getCurrentCounter() == rhs.getCurrentCounter())
((!currentCounterIsSet() && !rhs.currentCounterIsSet()) || (currentCounterIsSet() && rhs.currentCounterIsSet() && getCurrentCounter() == rhs.getCurrentCounter()))
;
}
@@ -140,7 +141,8 @@ void to_json(nlohmann::json& j, const Image_buffer_status& o)
j["image_numbers"] = o.m_Image_numbers;
j["total_slots"] = o.m_Total_slots;
j["available_slots"] = o.m_Available_slots;
j["current_counter"] = o.m_Current_counter;
if(o.currentCounterIsSet())
j["current_counter"] = o.m_Current_counter;
}
@@ -151,7 +153,11 @@ void from_json(const nlohmann::json& j, Image_buffer_status& o)
j.at("image_numbers").get_to(o.m_Image_numbers);
j.at("total_slots").get_to(o.m_Total_slots);
j.at("available_slots").get_to(o.m_Available_slots);
j.at("current_counter").get_to(o.m_Current_counter);
if(j.find("current_counter") != j.end())
{
j.at("current_counter").get_to(o.m_Current_counter);
o.m_Current_counterIsSet = true;
}
}
@@ -202,6 +208,15 @@ int64_t Image_buffer_status::getCurrentCounter() const
void Image_buffer_status::setCurrentCounter(int64_t const value)
{
m_Current_counter = value;
m_Current_counterIsSet = true;
}
bool Image_buffer_status::currentCounterIsSet() const
{
return m_Current_counterIsSet;
}
void Image_buffer_status::unsetCurrent_counter()
{
m_Current_counterIsSet = false;
}

View File

@@ -84,10 +84,12 @@ public:
int64_t getAvailableSlots() const;
void setAvailableSlots(int64_t const value);
/// <summary>
/// Counter of changes in the image buffer - either new start message or new image added. For optimization one can only load new images/datasets from the HTTP if this value changes.
/// Counter of changes in the image buffer - either new start message or new image added. For optimization one can only load new images/datasets from the HTTP if this value changes. Counter is optional as it was not implemented in older versions to avoid breaking change
/// </summary>
int64_t getCurrentCounter() const;
void setCurrentCounter(int64_t const value);
bool currentCounterIsSet() const;
void unsetCurrent_counter();
friend void to_json(nlohmann::json& j, const Image_buffer_status& o);
friend void from_json(const nlohmann::json& j, Image_buffer_status& o);
@@ -103,7 +105,7 @@ protected:
int64_t m_Available_slots;
int64_t m_Current_counter;
bool m_Current_counterIsSet;
};

View File

@@ -693,7 +693,6 @@ components:
- available_slots
- max_image_number
- min_image_number
- current_counter
properties:
min_image_number:
type: integer
@@ -727,6 +726,7 @@ components:
description: |
Counter of changes in the image buffer - either new start message or new image added.
For optimization one can only load new images/datasets from the HTTP if this value changes.
Counter is optional as it was not implemented in older versions to avoid breaking change
image_format_settings:
type: object
required:

File diff suppressed because one or more lines are too long

View File

@@ -10,7 +10,7 @@ Name | Type | Description | Notes
**image_numbers** | **List[int]** | Image numbers currently present in the buffer. |
**total_slots** | **int** | Number of slots in the image buffer. This number, compared to number of images in data collection and frame rate will determine \&quot;retention\&quot; rate of the image buffer. |
**available_slots** | **int** | Slots available for the data collection |
**current_counter** | **int** | Counter of changes in the image buffer - either new start message or new image added. For optimization one can only load new images/datasets from the HTTP if this value changes. |
**current_counter** | **int** | Counter of changes in the image buffer - either new start message or new image added. For optimization one can only load new images/datasets from the HTTP if this value changes. Counter is optional as it was not implemented in older versions to avoid breaking change | [optional]
## Example

View File

@@ -1,12 +1,12 @@
{
"name": "jungfraujoch-frontend",
"version": "1.0.0-rc.120",
"version": "1.0.0-rc.121",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "jungfraujoch-frontend",
"version": "1.0.0-rc.120",
"version": "1.0.0-rc.121",
"license": "GPL-3.0",
"dependencies": {
"@emotion/react": "^11.10.4",

View File

@@ -29,8 +29,9 @@ export type image_buffer_status = {
/**
* Counter of changes in the image buffer - either new start message or new image added.
* For optimization one can only load new images/datasets from the HTTP if this value changes.
* Counter is optional as it was not implemented in older versions to avoid breaking change
*
*/
current_counter: number;
current_counter?: number;
};