Skip to content

Fix serialization and deserialization for ProvideServiceRequest in Gateway - #947

Open
NemanjaTrifunovicRTRK wants to merge 1 commit into
eclipse-score:mainfrom
NemanjaTrifunovicRTRK:gateway/serialization
Open

Fix serialization and deserialization for ProvideServiceRequest in Gateway#947
NemanjaTrifunovicRTRK wants to merge 1 commit into
eclipse-score:mainfrom
NemanjaTrifunovicRTRK:gateway/serialization

Conversation

@NemanjaTrifunovicRTRK

@NemanjaTrifunovicRTRK NemanjaTrifunovicRTRK commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The problem was with the deserialization of the field of type score::mw::com::impl::EventInfo and its std::string_view field name:

struct EventInfo
{
    std::string_view name;
    DataTypeMetaInfo data_type_meta_info;
};

std::string_view is essentially a pointer into a string, so its (de)serialization requires the string's value to be copied, not just the pointer.

Implementation extended:

  • score/mw/com/gateway/transport_layer/sample/messages/BUILD
  • score/mw/com/gateway/transport_layer/sample/messages/serialization.h

Unit tests extended:

  • score/mw/com/gateway/transport_layer/sample/messages/serialization.h

Issue #387

* std::string.
*/
template <>
inline score::Result<uint32_t> Deserialize<score::mw::com::impl::EventInfo>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specializing for this high-level type is probably too coarse.
I would expect that EventInfo falls into https://github.com/NemanjaTrifunovicRTRK/communication/blob/4bad624b0978207811515b9bdf449a7de8bd6622/score/mw/com/gateway/transport_layer/sample/messages/serialization.h#L394

This would mean you only need to provide Deserialize specializations for the internal non-trivially-copyable types.

Same pattern applies for Serialize(). Can you please check whether you can trim the fix into that direction?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LittleHuba LittleHuba Aug 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case I think we need to sharpen https://github.com/NemanjaTrifunovicRTRK/communication/blob/4bad624b0978207811515b9bdf449a7de8bd6622/score/mw/com/gateway/transport_layer/sample/messages/serialization.h#L75 to also exclude std::string_views. Once that is done, you should have the expected behavior I outlined above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check score/mw/com/gateway/transport_layer/sample/messages/serialization.h again.
I changed the implementation to not specialize EventInfo type.

@NemanjaTrifunovicRTRK
NemanjaTrifunovicRTRK force-pushed the gateway/serialization branch 3 times, most recently from 72eefe5 to bf6e433 Compare August 24, 2026 14:19
@NemanjaTrifunovicRTRK
NemanjaTrifunovicRTRK marked this pull request as draft August 24, 2026 14:20
@NemanjaTrifunovicRTRK
NemanjaTrifunovicRTRK marked this pull request as ready for review August 24, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants