image-spec icon indicating copy to clipboard operation
image-spec copied to clipboard

add OCI struct tags

Open cyphar opened this issue 9 years ago • 4 comments
trafficstars

Currently we only have json:"" struct tags for all of our exported types. While this is fine, maybe we should consider adding some OCI struct tags that add some information about the OCI specification (for example, is a particular field required or optional). This would mean that we could set up reflect-based validation that doesn't require us to keep updating the validation code and manually writing all of the checking.

cyphar avatar Nov 06 '16 01:11 cyphar

On Sat, Nov 05, 2016 at 06:24:49PM -0700, Aleksa Sarai wrote:

… we should consider adding some OCI struct tags that add some information about the OCI specification (for example, is a particular field required or optional).

This came up in opencontainers/runtime-spec#229. Folks seemed mostly positive but the PR was closed. I'm not sure why though, it doesn't seem like these tags could apply to ocitools (now runtime-tools), but that was @liangchenye's plan when he closed the PR. @liangchenye, can you fill us in?

wking avatar Nov 06 '16 04:11 wking

Currently runtime-tools is using omitempty for this purpose.

wking avatar Nov 10 '16 18:11 wking

i like this idea, and we had discussed it previously. It died-on-the-vine when it came to parsing and extracting the tags. Not terribly difficult, but just never got done

vbatts avatar Mar 09 '17 18:03 vbatts

SGTM.

jonboulle avatar Mar 09 '17 18:03 jonboulle