Skip to content

feat(config): add serde Serialize/Deserialize to RTCConfiguration#81

Open
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:feat/config-serde
Open

feat(config): add serde Serialize/Deserialize to RTCConfiguration#81
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:feat/config-serde

Conversation

@nightness
Copy link
Copy Markdown

Summary

  • Add #[derive(Serialize, Deserialize)] with #[serde(rename_all = "camelCase")] to RTCConfiguration and nested types (RTCIceServer, etc.)
  • Adds optional serde feature gate so it's opt-in
  • Replaces an old commented-out TODO test with a working round-trip JSON test
  • Enables JavaScript/JSON config interoperability

Test plan

  • cargo test -p rtc test_configuration_json_round_trip
  • Verify camelCase keys (iceServers, iceTransportPolicy, etc.) in serialized output
  • Verify deserialization from camelCase JSON

🤖 Generated with Claude Code

Adds serde round-trip support to RTCConfiguration using W3C camelCase
field names (iceServers, iceTransportPolicy, bundlePolicy, rtcpMuxPolicy,
peerIdentity, iceCandidatePoolSize). All dependent types already had serde
derives (RTCIceServer, RTCBundlePolicy, RTCIceTransportPolicy,
RTCRtcpMuxPolicy, RTCSdpSemantics).

Certificates are excluded via #[serde(skip)] because they contain
private-key material. Use RTCCertificate::serialize_pem() / from_pem()
to persist certificates separately.

Adds test_configuration_json_round_trip to replace the previously
commented-out Go test with a Rust equivalent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant