OBOFoundry.github.io
OBOFoundry.github.io copied to clipboard
operations.yml has the fields in an annoying order for humans
I am working on moving some former OBO Ops members to the alumni list. That involves hand-editing operations.yaml. The record there start with affiliation, with name buried somewhere in the middle, which makes it much tricker to correctly make edits (adding or removing someone). For example:
-- affiliation: name: University at Buffalo, Buffalo ror: 01y64my43 country: USA github: alanruttenberg groups: -- outreach link: http://sciencecommons.org/about/whoweare/ruttenberg/ name: Alan Ruttenberg orcid: 0000-0002-1604-3078 wikidata: Q30508557 -- affiliation:
(and then the next person's record starts)
I tried to make the file more human-friendly by putting the fields in a more logical order, with "name" first, but that broke the tests, which intentionally check for field order to avoid problems (whether accidental or malicious). See PR here, which I will close without merging: https://github.com/OBOFoundry/OBOFoundry.github.io/pull/2725
The failing test in question was located here: https://github.com/OBOFoundry/OBOFoundry.github.io/blob/master/tests/test_memberships.py
I assume the point of testing against a sorted set of fields is to ensure that a) no fields are missing and b) no extra fields are provided? If so, this is something that can be tested more directly with the Pydantic model validator: https://docs.pydantic.dev/latest/concepts/models/#extra-data
Discussed on 2025-06-24 Ops call. The alphanumeric checks are in place to prevent duplications and issues with indents etc., so it's desirable to keep those checks in place. I'll look into the Pydantic model validator and come back with a more thorough response later.