Skip to content

[Issue]: minContains on ome.series is inert, so an empty series validates #602

Description

@vboussot

Describe the issue

schemas/ome.schema constrains series like this:

"series": {
  "description": "An array of the same length and the same order as the images defined in the OME-XML",
  "type": "array",
  "items": {
    "type": "string"
  },
  "minContains": 1
}

In JSON Schema 2020-12, minContains has no effect unless contains is present in the same schema object. There is no contains here, so the keyword is ignored and

{"ome": {"series": [], "version": "0.9.dev1"}}

validates, even though series is required.

The same shape is in the 0.4, 0.5 and 0.6rc0 schemas, and on both main and 0.9dev. By contrast schemas/axes.schema on main pairs minContains with contains, where it does take effect.

Two questions, in order:

  1. Should an empty series be valid? The description ties its length to the number of images in the OME-XML, which suggests it should not be.
  2. If it should not, minItems: 1 expresses it. That changes which documents validate, so it seemed better to ask here than to fold it into a PR.

Happy to send the change once the first question is settled, or to move the discussion to ome/ngff if the normative half belongs there.

Noticed while vendoring the 0.9.dev1 schemas into ngff-zarr, alongside ome/ngff-spec#195. Related to ome/ngff-spec#194, which asks for JSON linting in the repository: a rule for context-dependent keywords would catch this class of thing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions