GeezerVison is showing github.com — api/types/network: separate Summary from Inspect by corhere · Pull Request #50878 · moby/moby
Conversation
corhere
commented
Sep 2, 2025
•
edited by vvoland
Loading
Uh oh!
There was an error while loading. Please reload this page.
- 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)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
thompson-shaun reacted with eyes emoji
thompson-shaun assigned akerouanton
thompson-shaun assigned robmry
thompson-shaun requested review from akerouanton and robmry
It's not ready for review yet ... it's stacked on #50860, which needs a second review. As this one is a release blocker, I've marked the other as a release blocker too.
|
thompson-shaun reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
Name string // Name is the name of the network
|
|
|
ID string `json:"Id"` // ID uniquely identifies a network on a single machine
|
|
|
Created time.Time // Created is the time the network created
|
|
|
Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level)
|
There was a problem hiding this comment.
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
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Sep 5, 2025
Reviewers
robmry
robmry approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|