Skip to content

buffa-yaml: add Phase 1 YAML serialization crate#155

Open
rsd-darshan wants to merge 5 commits into
anthropics:mainfrom
rsd-darshan:feat/buffa-yaml-phase1
Open

buffa-yaml: add Phase 1 YAML serialization crate#155
rsd-darshan wants to merge 5 commits into
anthropics:mainfrom
rsd-darshan:feat/buffa-yaml-phase1

Conversation

@rsd-darshan
Copy link
Copy Markdown

Closes #101 (Phase 1).

Summary

  • Adds a new published workspace member buffa-yaml that routes buffa's existing protobuf-JSON serde impls through serde_norway as the YAML carrier, giving full protobuf-JSON-mapping semantics on YAML: camelCase/snake_case field names, quoted int64/uint64, base64 bytes, enum string names, and canonical WKT encodings
  • Public API: to_string, to_writer, from_str, from_slice, from_reader — each gated on Message + Serialize/DeserializeOwned, mirroring serde_json / serde_norway conventions
  • Error type wraps serde_norway::Error and exposes Location { line, column } for diagnostics without requiring callers to depend on the carrier directly
  • Carrier choice validated against buffa-test generated types and WKTs; zero changes to buffa core required

Test plan

23 tests covering the full Phase 1 scope:

  • Every WKT: Empty, Timestamp, Duration, FieldMask, Value (null/bool/number/string), ListValue, Struct
  • int64/uint64 serialized as quoted strings (precision check)
  • double NaN and Infinity round-trip
  • Base64 bytes round-trip
  • Oneof field naming
  • Maps with string→string and string→int keys
  • from_slice / to_writer / from_reader mirror from_str / to_string
  • YAML-specific scalar resolution: hex literals (0x1F), null (~), Norway-problem string ("no")
  • Error::location() exposes line/col without panicking

New published workspace member that routes buffa's existing protobuf-JSON
serde impls through serde_norway, giving full protobuf-JSON-mapping semantics
on a YAML carrier: camelCase/snake_case field names, quoted int64/uint64,
base64 bytes, enum string names, and canonical WKT encodings.

Public API: to_string, to_writer, from_str, from_slice, from_reader with an
Error wrapper that exposes line/column Location for diagnostics.

Carrier choice (serde_norway 0.9) is validated against buffa-test generated
types and WKTs; zero changes required to buffa core.
Expand struct literals to multi-line format per rustfmt style, replace
approximate 3.14 literal with 1.5 to satisfy clippy::approx_constant,
and mark the crate-level doc example as `ignore` so rustdoc does not
attempt to compile a placeholder struct.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@rsd-darshan
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 28, 2026
@rsd-darshan
Copy link
Copy Markdown
Author

Hi @iainmcgin, just a gentle ping in case this got buried — happy to make any changes if needed.

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.

buffa-yaml: YAML serialization extension crate

1 participant