kubewarden / policy-sdk-go

Kubewarden Policy SDK for the Go programming language
https://kubewarden.io
Apache License 2.0
8 stars 7 forks source link

feat: Export and json-tag fields of manifest.OciImageManifestResponse{} #82

Closed viccuad closed 5 months ago

viccuad commented 5 months ago

Description

Relates to https://github.com/kubewarden/cel-policy/issues/31

Setting the json tags is needed as we marshal this struct in the cel-policy, kw.oci.getManifest() function to return it as map.

To honour this new contract with the json tags, mark fields as exported. This also simplifies creating mocks with this type struct without type casting.

Note that API is still backwards compatible as we were using the fields via the getters, which are untouched. Plus, cel-policy seems to be the first consumer of this.

Test

CI, and the followup cel-policy PR.

Additional Information

Tradeoff

Potential improvement