Plugins: Formatieren von Payloads per jq #20913
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #20501
Erster Versuch, erst mal nur im MQTT-Plugin.
Achtung: Das erste Mal, dass ich Go-Code umbaue bzw. in Go programmiere. Anfängerfehler vorprogrammiert, was vielleicht auch die nachfolgenden Fragen zeigen.
Fragen:
FormatPayload-Funktion getestet (die gibt es eigentlich nur, damit man sie im Test nutzen kann 😅 ), aber eigentlich wäre es besser zu testen, was am Ende zum.client.Publishgesendet wird – also was letztendlich "rausgeht". Sehe aktuell nicht, wie man dasm.client.Publishim test mocken könnte, damit man dort daspayloadrausfischen kann.Ich denke ich brauche etwas Hilfe/Denkanstöße von erfahrenen Programmieren, damit ich hier sauber weiterkomme. Gebt gerne kritisches Feedback und/oder ein paar Hinweise, wie ihr es angehen könntet.
Summary by Sourcery
Introduce payload formatting using
jqin the MQTT plugin and refactor publishing logic.New Features:
jqexpressions before publishing.Enhancements:
FormatPayloadandPublishmethods.Tests:
jqpayload formatting functionality.