Skip to content

fix(json): use bytes sink for CBOR encoding - #3580

Merged
jihuayu merged 1 commit into
apache:unstablefrom
XYenon:fix/jsoncons-cbor-bytes-sink
Aug 9, 2026
Merged

fix(json): use bytes sink for CBOR encoding#3580
jihuayu merged 1 commit into
apache:unstablefrom
XYenon:fix/jsoncons-cbor-bytes-sink

Conversation

@XYenon

@XYenon XYenon commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Why

string_sink<std::string> is incompatible with jsoncons 1.9.0 because the CBOR encoder appends buffers through const uint8_t *, while string_sink<std::string> expects const char *.

Use bytes_sink<std::string>, which is intended for binary output and is also used by jsoncons' encode_cbor implementation. It is compatible with jsoncons 1.8.1 and 1.9.0 and produces the same serialized CBOR output.

Related downstream update: NixOS/nixpkgs#550324

Validation

  • ./x.py build build-pr --ninja --unittest -j 8
  • ./x.py test cpp build-pr — 600 passed, 1 skipped
  • ./x.py test go build-pr -run 'TestJson/JSON_storage_format_CBOR' -count=1
  • ./x.py check format --clang-format-path clang-format-18
  • ./x.py check tidy build-pr -j 8 --clang-tidy-path clang-tidy-18 --run-clang-tidy-path run-clang-tidy-18
  • ./x.py check golangci-lint
  • git diff --check

Prepared with assistance from Amp for investigating jsoncons API compatibility, preparing the focused change, and running local validation.

@jihuayu
jihuayu enabled auto-merge (squash) August 9, 2026 04:33
@jihuayu
jihuayu merged commit 50cd1f0 into apache:unstable Aug 9, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants