Closed ktarplee closed 1 month ago
Hi @ktarplee , thanks for opening this issue.
oras-go
actually supports warnings via a callback function HandleWarning()
of Repository
. Here is an example of configuring this callback.
Since the warning header is specific to the Repository
target, it is not appropriate to add that to Copy Options.
Starting from v1.1.0
, ORAS CLI logs the warning messages to STDERR. Here is the related code: https://github.com/oras-project/oras/blob/9ffdb3eec60b969d842af1a9e699202e0827fa01/cmd/oras/internal/option/remote.go#L273-L288
I never saw that interface. Thanks for point it out. Looks like you have this feature covered well.
The spec describes warnings here.
One way to expose warning in a backwards compatible and non-invasive way would be to add a callback function to the CopyOptions (or similar) that returns the descriptor and a slice of warnings as strings. So a field like
warnings func() (ocispec.Descriptor, []string)
.Obviously the oras CLI should define this function to display the warnings nicely formatted to STDERR.