Skip to content

feat: add serialization configuration for sorting map keys#196

Merged
liuq19 merged 2 commits into
mainfrom
chore/cfg
Nov 4, 2025
Merged

feat: add serialization configuration for sorting map keys#196
liuq19 merged 2 commits into
mainfrom
chore/cfg

Conversation

@liuq19

@liuq19 liuq19 commented Nov 3, 2025

Copy link
Copy Markdown
Collaborator

What type of PR is this?

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
zh(optional):

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:


Note

Adds a configurable option to sort map keys during JSON serialization, with supporting formatter changes, tests, and a minor tooling script; bumps version to 0.5.6.

  • Serialization (serde):
    • Configurable sorting: Introduce SerializeCfg and Serializer::sort_map_keys() to sort map keys during serialization.
    • Implementation: Add MapState::{Stream, Sorted} and write_sorted_entries to buffer, sort, and emit entries; require Formatter: Clone to serialize buffered values.
    • Pretty output: Use PrettyFormatter::new() in to_writer_pretty.
    • Tests: Add tests validating default vs sorted behavior and feature sort_keys interaction.
  • Tooling:
    • Add scripts/fmt_fix.sh for formatting (with --check support).
  • Version:
    • Bump crate to 0.5.6.

Written by Cursor Bugbot for commit d9ca8ba. This will update automatically on new commits. Configure here.

@liuq19 liuq19 force-pushed the chore/cfg branch 2 times, most recently from 1a4174e to 6603145 Compare November 4, 2025 05:36
@PureWhiteWu

Copy link
Copy Markdown
Contributor

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


@liuq19 liuq19 merged commit 8bcb095 into main Nov 4, 2025
18 checks passed
@liuq19 liuq19 deleted the chore/cfg branch November 4, 2025 06:01
Comment thread Cargo.toml
readme = "README.md"
repository = "https://github.com/cloudwego/sonic-rs"
version = "0.5.5"
version = "0.5.6"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we create a git tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants