Config schema: optional fields are not all nullable

Open
#837 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
json

Research direction

Start with config.md and schema/config-schema.json, then inspect defs.json for the existing stringPointer and nullable patterns used by Entrypoint, Cmd, Volumes, and Labels. Check each other optional field, including history.empty_layer, and validate representative configurations that set optional fields to null; done means all optional fields accepted by the specification validate successfully.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Go
Stars
4.5k
Forks
891
Avg merge
27d 2h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opencontainers/image-spec

All issues in opencontainers/image-spec

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.