kubewarden / policy-fetcher

Crate used by Kubewarden that is able to pull policies from OCI registries and HTTP servers.
https://kubewarden.io
Apache License 2.0
8 stars 8 forks source link

Feature Request: Provide versioned and latest types for `VerificationConfig` #59

Closed viccuad closed 2 years ago

viccuad commented 2 years ago

Is your feature request related to a problem?

From https://github.com/kubewarden/policy-fetcher/pull/55#issuecomment-1055527972, right now, VerificationConfig has a hardcoded version. If we were to bump the version and change the VerificationConfigstruct, or any struct inside of it, it will break for consumers (given that we set deny_unknown_fields).

Solution you'd like

Provide an aliased type, VerificationConfigLatest or similar, that maps to the latest config. Provide versioned types, VerificationConfigV1, that implements the current type. Provide an enum that maps the latest version to the different versions. This enum can implement TryInto in the future, to seamlessly cast versions to the latest.

Consumers will only consume VerificationConfigLatest.

Alternatives you've considered

No response

Anything else?

No response

flavio commented 2 years ago

Implemented