fix: rename ManifestAddArtifactOptions.Annotations to ArtifactAnnotations#28981
fix: rename ManifestAddArtifactOptions.Annotations to ArtifactAnnotations#28981stefan8 wants to merge 1 commit into
Conversation
cacc494 to
d9984e8
Compare
| 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"` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>
d9984e8 to
34121d4
Compare
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
| LayerType: opts.LayerType, | ||
| ExcludeTitles: opts.ExcludeTitles, | ||
| Annotations: opts.Annotations, | ||
| Annotations: opts.ArtifactAnnotations, |
There was a problem hiding this comment.
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) |
The artifact-specific
Annotationsfield onManifestAddArtifactOptionscollided (same swaggerx-go-name) with the embeddedManifestAnnotateOptions.Annotations, so Go clients generated from the spec fail to compile. This renames it toArtifactAnnotations(the name the sibling options struct already uses for that JSON tag); the wire format is unchanged.Checklist
git commit -s).Fixes: #22966in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?