# dev_container: Make all \`PortAttributes\` fields optional \(\#53799\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/cd12d5f98dc522ed87b985b25f2534a866ea83e8)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: cd12d5f98dc522ed87b985b25f2534a866ea83e8

Requested commit: cd12d5f98dc522ed87b985b25f2534a866ea83e8

Commit: cd12d5f98dc522ed87b985b25f2534a866ea83e8

Tree: a9b74b8f058968968ce1ced18d60807183cb5a3a

Author: Kunall Banerjee

Committer: GitHub

## Message

```
dev_container: Make all `PortAttributes` fields optional (#53799)

The Dev Container [metadata
reference](https://containers.dev/implementors/json_reference/#port-attributes)
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:

- [x] 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](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] 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
```

## Parents

- [98f94e20643c4012a05510d78f3fdf820e15df7e](https://git.cafe/gitcafe/zed/commit/98f94e20643c4012a05510d78f3fdf820e15df7e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/cd12d5f98dc522ed87b985b25f2534a866ea83e8?format=markdown)
