Skip to content

dev_container: Make all PortAttributes fields optional#53799

Merged
KyleBarton merged 3 commits intomainfrom
fix-issue-53686-b8e7430567e6bc46
Apr 20, 2026
Merged

dev_container: Make all PortAttributes fields optional#53799
KyleBarton merged 3 commits intomainfrom
fix-issue-53686-b8e7430567e6bc46

Conversation

@yeskunall
Copy link
Copy Markdown
Member

The Dev Container metadata reference defines all five PortAttributes fields (elevateIfNeeded, label, onAutoForward, protocol, requireLocalPort) as optional with defined defaults. The struct required all of them, causing deserialization failures for any portsAttributes entry that omitted a field.

Add #[serde(default)] to each field, wrap label and protocol in Option<T> (spec default: not set), and derive Default on OnAutoForward with Notify as the default variant (spec default: notify). The bool fields already default to false via serde(default), matching the spec.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Closes #53686.

Release Notes:

  • Made all PortAttributes fields optional according to the Dev Container spec

…er spec

The devcontainer JSON reference defines all five PortAttributes fields
(label, protocol, onAutoForward, requireLocalPort, elevateIfNeeded) as
optional with defined defaults. The struct required all of them, causing
deserialization failures for any portsAttributes entry that omitted a
field.

Add #[serde(default)] to each field, wrap label and protocol in
Option<T> (spec default: not set), and derive Default on OnAutoForward
with Notify as the default variant (spec default: notify). The bool
fields already default to false via serde(default), matching the spec.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 13, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Apr 13, 2026
@yeskunall
Copy link
Copy Markdown
Member Author

@KyleBarton -- there you go. Thanks for the review! 💖

@KyleBarton KyleBarton self-requested a review April 20, 2026 17:04
@KyleBarton KyleBarton merged commit cd12d5f into main Apr 20, 2026
31 checks passed
@KyleBarton KyleBarton deleted the fix-issue-53686-b8e7430567e6bc46 branch April 20, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

devcontainer.json fails to deserialize when portsAttributes entries omit optional fields (requireLocalPort, label, protocol, etc.)

2 participants