fix(rest): parse text/json5 payloads with json5 crate instead of serd… - #2657
Open
xiao-yang25 wants to merge 2 commits into
Open
fix(rest): parse text/json5 payloads with json5 crate instead of serd…#2657xiao-yang25 wants to merge 2 commits into
xiao-yang25 wants to merge 2 commits into
Conversation
…e_json Previously, TEXT_JSON5 payloads were parsed with serde_json, which fails on JSON5 syntax such as unquoted keys, comments, NaN, etc. This caused an unexpected base64 fallback. This now uses the json5 crate, with string fallback on parse failure, so consumers always receive readable text. Fixes eclipse-zenoh#2074 Signed-off-by: xiaoyang <xy1453417528@gmail.com>
Author
|
Could a maintainer please add the |
Author
|
I've tested the changes and added the missing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Title:
fix(rest): parse TEXT_JSON5 payloads with json5 crate
Body:
What
Use the
json5crate to parseTEXT_JSON5encoded payloads in the REST plugin,instead of treating them as strict JSON via
serde_json.Why
Fixes #2074
JSON5 payloads (unquoted keys, single-quoted strings, trailing commas, comments,
NaN/Infinity) are valid TEXT_JSON5 but fail
serde_jsonparsing, causing anunexpected base64 fallback that makes the data unreadable to consumers.
Behavior change
{a: 1}){"a":1})Test plan
cargo clippy -p zenoh-plugin-rest --all-targets -- --deny warningscargo test -p zenoh-plugin-rest🏷️ Label-Based Checklist
Based on the labels applied to this PR, please complete these additional requirements:
Labels:
bug🐛 Bug Fix Requirements
Since this PR is labeled as a bug fix, please ensure:
Why this matters: Bugs without tests often reoccur.
Instructions:
- [ ]to- [x])This checklist updates automatically when labels change, but preserves your checked boxes.