Skip to content

RFC-4: the anatomical orientation vocabulary is no longer enforced #585

Description

@vboussot

orientation.yml defines AnatomicalOrientationValues with its 24 values and
their definitions, but no slot uses it as a range, so none of the generated
artifacts check the vocabulary. The published orientation.py takes this
happily, and the JSON Schema and the TypeScript interface do too:

AnatomicalOrientation(type="planetary", value="north-to-south")

RFC 4 defines a single type, "anatomical", and takes value from the
vocabulary in the same document.

It looks like this went out with 535e661

At its parent 183ab43, gen-json-schema produced
"type": {"const": "anatomical"} and
"value": {"$ref": "#/$defs/AnatomicalOrientationValues"}. 535e661, "Remove
constraints on orientation name, type slots. Make them generally reusable
throughout the specification", removed the attributes block:

   AnatomicalOrientation:
     is_a: Orientation
-    attributes:
-      type:
-        range: string
-        required: true
-        equals_string: "anatomical"
-        ifabsent: string(anatomical)
-      value:
-        range: AnatomicalOrientationValues
-        required: true

The aim was the shared name and type slots, and the range on value looks
like it went along for the ride.

Restoring it without touching the shared slots

slot_usage narrows an inherited slot inside one class, which is what the file
already does for ChannelAxis, SpaceAxis and TimeAxis:

  AnatomicalOrientation:
    is_a: Orientation
    slot_usage:
      type:
        equals_string: anatomical
      value:
        range: AnatomicalOrientationValues

That brings back the const and the $ref in orientation.schema.json, and
gives type: Literal["anatomical"] and value: AnatomicalOrientationValues in
orientation.py. orientation.ts stays as it is, since gen-typescript emits
AnatomicalOrientation as an empty interface extending Orientation and does
not apply the subclass slot_usage.

It also helps downstream: when 9472330 added superficial-to-deep and the five
other layered and polarized tissue values, they could not be picked up by
regenerating, since the generated types carry the descriptions of the
vocabulary but not the vocabulary itself.

For context, the hand-written schemas/axis_orientation.schema added for
0.9.dev1 in ome/ngff-spec#190 does constrain both fields, so the normative side
is covered there. This issue is about the model here and the artifacts generated
from it, which implementations bundle and reuse.

Happy to open a PR if that would be useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions