hivemq / hivemq-edge

HiveMQ Edge is an MQTT gateway that enables interoperability between OT devices and IT systems. It translates diverse protocols into MQTT for streamlined communication and helps organize data into a unified namespace, making managing and streaming data across your infrastructure easier.
http://hivemq.com
Apache License 2.0
92 stars 21 forks source link

refactor(20139): Add validation and error handling for PROTOBUF code #307

Closed vanch3d closed 4 months ago

vanch3d commented 4 months ago

See https://hivemq.kanbanize.com/ctrl_board/57/cards/20139/details/

The PR fixes a few bugs with the text version of PROTOBUF in the Schema node and its side panel.

A field for selecting the active message has been added to the JSON Schema of the PROTOBUF configuration. Validation of the code and error reporting are now supported.

The PROTOBUF code is now compiled to a descriptor buffer and then encoded to a base64 fully on the browser side. It means the end-user has access to the full flow of PROTOBUF schemas, from the editing (or copy-and-paste) to the validation, then to the submission to the backend, then to the listing of created schemas, then finally to the modifying of the original code.

The client-side encoding relies on a self-described experimental feature of the protobufjs library (and a 5 years old extension) so an encoding-decoding test has been added to validate the PROTOBUF source.

Out-of-scope

After

screenshot-localhost_3000-2024 03 08-10_41_06

screenshot-localhost_3000-2024 03 08-10_42_22