Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C8Y Mapper converts alarms/events to only JSON over MQTT #2242

Open
rina23q opened this issue Sep 11, 2023 · 0 comments
Open

C8Y Mapper converts alarms/events to only JSON over MQTT #2242

rina23q opened this issue Sep 11, 2023 · 0 comments
Labels
improvement User value theme:c8y Theme: Cumulocity related topics theme:telemetry Theme: Telemetry data

Comments

@rina23q
Copy link
Member

rina23q commented Sep 11, 2023

Is your feature improvement request related to a problem? Please describe.
Cumulocity Mapper converts alarms and events to either SmartREST or JSON over MQTT up to the payload patterns.
My proposal is to stop converting to SmartREST in any case, and converts to only JSON over MQTT.

Why?
The cost of supporting SmartREST with correct validation is quite high compared to the efforts.
We can simplify our current c8y-mapper code and stronger and easier validation for payload by using external JSON crate.
SmartREST is CSV-like format, which causes a problem how to escape special characters. Also, since it's not completely CSV, we cannot use external CSV crate.

For example, if user publishes this payload to the event topic:

{
   "type":"foo,bar",
   "text":"Someone clicked",
}

The event type foo,bar is valid, however, we need an escape for , in SmartREST, whilst we don't need any escape for JSON over MQTT.

Another example, if given type contains ":

{
   "type":"foo\"bar",
   "text":"Someone clicked",
}

The event type foo"bar is valid, however, what do we need to escape " for SmartREST? Two double-quotes or backslash? If JSON over MQTT, this escape is surely backslash as it is given by input JSON.

Describe the solution you'd like

Describe alternatives you've considered
Nothing

Additional context
#2221 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement User value theme:c8y Theme: Cumulocity related topics theme:telemetry Theme: Telemetry data
Projects
None yet
Development

No branches or pull requests

1 participant