Skip to content

fix: rename ManifestAddArtifactOptions.Annotations to ArtifactAnnotations#28981

Open
stefan8 wants to merge 1 commit into
podman-container-tools:mainfrom
stefan8:fix/manifest-add-artifact-annotations-swagger
Open

fix: rename ManifestAddArtifactOptions.Annotations to ArtifactAnnotations#28981
stefan8 wants to merge 1 commit into
podman-container-tools:mainfrom
stefan8:fix/manifest-add-artifact-annotations-swagger

Conversation

@stefan8

@stefan8 stefan8 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

The artifact-specific Annotations field on ManifestAddArtifactOptions collided (same swagger x-go-name) with the embedded ManifestAnnotateOptions.Annotations, so Go clients generated from the spec fail to compile. This renames it to ArtifactAnnotations (the name the sibling options struct already uses for that JSON tag); the wire format is unchanged.

Checklist

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all commits (git commit -s).
  • Referenced issues using Fixes: #22966 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

Fixed a duplicate field name in the generated libpod Swagger definition for the manifest add-artifact options, which could break generated API clients.

@github-actions github-actions Bot added the kind/api-change Change to remote API; merits scrutiny label Jun 19, 2026
@stefan8 stefan8 force-pushed the fix/manifest-add-artifact-annotations-swagger branch 2 times, most recently from cacc494 to d9984e8 Compare June 19, 2026 11:25
Comment thread pkg/bindings/manifests/types.go Outdated
LayerType *string `json:"artifact_layer_type,omitempty"`
ExcludeTitles *bool `json:"artifact_exclude_titles,omitempty"`
Subject *string `json:"artifact_subject,omitempty"`
ArtifactAnnotations map[string]string `json:"artifact_annotations,omitempty"`

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.

We cannot change the types in pkg/bindings as this would be a breaking change for all consumers of the package. pkg/bindings is also meant to be uses by third parties to talk to the podman API so we need to keep it stable

@stefan8 stefan8 Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Understood, I reverted the pkg/bindings changes so the public API is unchanged — the rename is now only in the entities ManifestAddArtifactOptions struct, which is what the swagger:model is generated from, so that's enough to drop the duplicate x-go-name.

The pr-should-include-tests check is red because this is a go-symbol rename only, so there's no new behavior to test - the existing artifact_annotations coverage in test/apiv2/15-manifest.at already exercises the field.

…ions

The swagger:model ManifestAddArtifactOptions (pkg/domain/entities) embeds
ManifestAnnotateOptions, which already has an Annotations field, and also
declared its own Annotations field. The generated swagger therefore emitted
two members with the same x-go-name, so Go clients generated from the spec
failed to compile (the reproducer on the issue).

Rename the field in the entities struct to ArtifactAnnotations, matching the
sibling ManifestModifyOptions. The json/schema tags stay "artifact_annotations",
so the REST API wire format is unchanged.

pkg/bindings is intentionally left untouched: it is part of the public client
API used by third parties, so its option/field names must stay stable.
swagger.yaml is generated by make swagger from these annotations and is left
for CI to regenerate.

Fixes: podman-container-tools#22966

Signed-off-by: Grzegorz Szczepanczyk <g.szczepanczyk@getprintbox.com>
@stefan8 stefan8 force-pushed the fix/manifest-add-artifact-annotations-swagger branch from d9984e8 to 34121d4 Compare June 20, 2026 10:39
@packit-as-a-service

Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@stefan8 stefan8 requested a review from Luap99 June 21, 2026 06:14
@Honny1 Honny1 added the No New Tests Allow PR to proceed without adding regression tests label Jun 22, 2026

@Honny1 Honny1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have some questions.

LayerType: opts.LayerType,
ExcludeTitles: opts.ExcludeTitles,
Annotations: opts.Annotations,
Annotations: opts.ArtifactAnnotations,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this correct? It will set ArtifactAnnotation into the embedded field Annotations.

options.WithConfig(opts.Config)
options.WithExcludeTitles(opts.ExcludeTitles).WithSubject(opts.Subject)
options.WithAnnotations(opts.Annotations)
options.WithAnnotations(opts.ArtifactAnnotations)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api-change Change to remote API; merits scrutiny No New Tests Allow PR to proceed without adding regression tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants