api/types/network: separate Summary from Inspect by corhere · Pull Request #50878 · moby/moby · GitHub
Skip to content

api/types/network: separate Summary from Inspect - #50878

Merged
thaJeztah merged 1 commit into
moby:masterfrom
corhere:network-inspect-concrete-type
Sep 4, 2025
Merged

thaJeztah merged 1 commit into
moby:masterfrom
corhere:network-inspect-concrete-type

Conversation

@corhere

@corhere corhere commented Sep 2, 2025 •

Copy link
Copy Markdown
Contributor

- What I did
I made network.Summary and network.Inspect distinct types so they can be extended independently.

- How I did it

  • Moved all fields common to both GET /networks (List Networks) and GET /networks/{id} (Inspect Network) API endpoints into a base network.Network struct.
  • Changed network.Summary and network.Inspect to distinct struct types which both embed network.Network
  • Added backend methods which return []network.Summary, distinct from the existing []network.Inspect methods

- How to verify it

- Human readable description for the release notes

- Types `"github.com/moby/moby/api/types/network".Summary` and `"github.com/moby/moby/api/types/network".Inspect` are no longer aliases, and most of their fields have been moved into an embedded struct. Engine API clients may require some source-level changes when migrating to the new github.com/moby/moby/api module.

- A picture of a cute animal (not mandatory but encouraged)

@corhere corhere added this to the 29.0.0 milestone Sep 2, 2025
@corhere corhere added area/api API area/networking Networking impact/changelog impact/go-sdk Noteworthy (compatibility changes) in the Go SDK release-blocker PRs we want to block a release on labels Sep 2, 2025
@corhere
corhere requested a review from thaJeztah September 2, 2025 20:31
@corhere corhere added the kind/refactor PR's that refactor, or clean-up code label Sep 2, 2025
@robmry

robmry commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

While the network Summary and Inspect types have been aliases in Go's
type system, in practice there is a difference: the Containers and
Services fields are only populated when inspecting a network. Split out
the common fields into a base network.Network struct which is embedded
in the network.Summary and network.Inspect types.

Signed-off-by: Cory Snider <csnider@mirantis.com>
@corhere
corhere force-pushed the network-inspect-concrete-type branch from c1c83d3 to 1a86389 Compare September 4, 2025 17:51
@corhere
corhere marked this pull request as ready for review September 4, 2025 17:51

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a follow-up; considering if we want to define (typed) consts for Scope

@thaJeztah
thaJeztah merged commit 6da8589 into moby:master Sep 4, 2025
253 of 254 checks passed
@thompson-shaun thompson-shaun moved this from New to Complete in 🔦 Maintainer spotlight Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API area/networking Networking impact/changelog impact/go-sdk Noteworthy (compatibility changes) in the Go SDK kind/refactor PR's that refactor, or clean-up code release-blocker PRs we want to block a release on

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants