Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullability of optional fields in manifests and descriptors #894

Open
tofay opened this issue Feb 3, 2022 · 1 comment
Open

Nullability of optional fields in manifests and descriptors #894

tofay opened this issue Feb 3, 2022 · 1 comment

Comments

@tofay
Copy link

tofay commented Feb 3, 2022

It's not clear whether optional fields in manifests and descriptors can be null. By extension, it's also not clear whether or not the canonicalized form of a manifest should omit or set to null any optional fields that are not provided.

I noticed that the config spec and schema allows that optional fields may be null:

Note: Any OPTIONAL field MAY also be set to null, which is equivalent to being absent.

The schemas for manifests and descriptors don't allow for null values. Should the spec be updated to clarify this? Happy to do that.

@sudo-bmitch
Copy link
Contributor

From the Go implementations, the preference is to omit the field, rather than explicitly set it to null, in the JSON. That's seen with omitempty defined on various fields. I don't believe this is a hard requirement, but it's a convention you'll see from most implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants