Skip to content

RFC-4: enforce the anatomical orientation vocabulary again - #595

Merged
lubianat merged 2 commits into
ome:mainfrom
vboussot:rfc4-restore-orientation-vocabulary
Aug 28, 2026
Merged

RFC-4: enforce the anatomical orientation vocabulary again#595
lubianat merged 2 commits into
ome:mainfrom
vboussot:rfc4-restore-orientation-vocabulary

Conversation

@vboussot

@vboussot vboussot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Closes #585.

AnatomicalOrientationValues is defined in the model, but nothing uses it as a range, so the generated artifacts let anything through:

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

This adds a slot_usage block to AnatomicalOrientation that narrows the two inherited slots, the same way ChannelAxis, SpaceAxis and TimeAxis already do. The shared name and type slots are left alone.

After pixi run gen-all, the JSON Schema has "const": "anatomical" and a $ref to the vocabulary again, and orientation.py has type: Literal["anatomical"] and value: AnatomicalOrientationValues. Both reject the example above and accept left-to-right. orientation.ts does not change, because gen-typescript writes AnatomicalOrientation as an empty interface extending Orientation.

The markdown keeps the orphan: true front matter from 0d68c8b, which gen-markdown does not write itself.

`orientation.yml` defines `AnatomicalOrientationValues` and its 24 values, but
no slot takes it as a range, so the generated artifacts accept anything:

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

535e661 made `name` and `type` reusable across the specification and removed
the `attributes` block of `AnatomicalOrientation`, which carried the range on
`value` along with it.

`slot_usage` narrows an inherited slot inside one class, which is what
`ChannelAxis`, `SpaceAxis` and `TimeAxis` already do here, so the shared slots
stay as they are.

`orientation.schema.json` gets back `"const": "anatomical"` and the `$ref` to
`AnatomicalOrientationValues`; `orientation.py` gets
`type: Literal["anatomical"]` and `value: AnatomicalOrientationValues`. Both
now refuse the example above and accept `left-to-right`. `orientation.ts` is
unchanged: `gen-typescript` emits `AnatomicalOrientation` as an empty interface
extending `Orientation` and does not apply the subclass `slot_usage`.

The markdown keeps the `orphan: true` front matter 0d68c8b added by hand, which
`gen-markdown` does not emit.
@github-actions

Copy link
Copy Markdown
Contributor

Automated Review URLs

@vboussot vboussot changed the title RFC-4: constrain the anatomical orientation type and value again RFC-4: enforce the anatomical orientation vocabulary again Aug 27, 2026

@thewtex thewtex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vboussot thank you 🙏 🚀

@lubianat lubianat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure on the details, but no red flags to me and @thewtex ok'd, so LGTM

@lubianat

Copy link
Copy Markdown
Contributor

Thank you, @vboussot! Merging it here...

@lubianat
lubianat merged commit 82c88f9 into ome:main Aug 28, 2026
4 checks passed
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

Successfully merging this pull request may close these issues.

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

3 participants