-
Notifications
You must be signed in to change notification settings - Fork 10
Validation check for reserved prefixes and suffixes #639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b600071
to
8afb8e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't completely oversee how this is intended to work, but generally looks reasonable to me apart from a few questions
@rettigl fixed most of what you were suggesting. Before, I was also missing that fields with reserved suffixes must be written as e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, apart from remaining debug code
NeXus defines reserved prefixes and suffixes that may only be used in a certain context.
Here, we implement checks for both prefixes and suffixes:
DECTRIS_
prefix is only valid for attributes inDECTRIS
detectors, i.e., inNXmx
). Any other use is prohibited. We check the context and log an error if such attributes exist out of context. Note that for some reserved prefixes, we can not write them from pynxtools, so their use is disallowed. We still write these attributes as undocumented, though (could be removed).NXobject
, but also inNXdata
andNXtransformations
). Note that you can use these suffixes freely outside of their scope (e.g. you can useFIELDNAME_end
) anyway you like if you are not withinNXtransformations
. Here, we basically check that if a reserved suffix is used, the initial field also exists (e.g. if we define a fieldmy_field_weights
, we check thatmy_field
exists as well.