opencontainers / image-spec

OCI Image Format
https://www.opencontainers.org/
Apache License 2.0
3.52k stars 652 forks source link

Config schema: optional fields are not all nullable #837

Open rcowsill opened 3 years ago

rcowsill commented 3 years ago

The config specification says "Any OPTIONAL field MAY also be set to null, which is equivalent to being absent":

Most fields in schema/config-schema.json are listed as optional, but only the following are explicitly nullable:

config.Entrypoint, config.Cmd, config.Volumes, config.Labels

This means that config files setting the other optionals to null (instead of omitting them) fail to validate against the schema.

It looks like defs.json#/definitions/stringPointer can be used for the optional string fields, and an optionalBoolean definition added for history.empty_layer. Optional objects/maps/arrays can use the same technique as Entrypoint etc.

Happy to make a PR if the above approach is OK.

vbatts commented 3 years ago

ah yeah, we went back and forth on this. There were reasons that a *string was not desirable, but it would take @wking notes to dig that up :grimacing: I think the correct would in the wording about the field being "null", should instead be something about being "empty"