Raise error if "copy/rename" 214 key tries to override schema fields from source 122 key

Merged
#47 · Created  · Last updated

Merged pull request

Merged in error_on_copy_collision (pull request #47)

57221ad·Author: ·Closed by: ·2024-01-31

Description

This is basically a no-op, but forces us to be more intentional with how we define the schemas in this repo.

A 214 key can be either “copied” or “renamed” from a source 122 key (most of the 214 keys are like this). In this case the 214 key shouldn’t be re-defining any schema fields that already exist in its source 122 key. For example “CRPIX<n>” is a 122 key that has type: int and “CRPIX<n>” is also in the 214 schema as a “copy” of 122’s “CRPIX<n>”. The 214 definition of this key shouldn’t repeat the type: int because it’s already carried over from 122.

Prior to this behavior any re-defined schema fields in 214 were silently overwritten with their 122 counterpart. This PR explicitly makes this case an Error. The main reason is that we don’t want to let ourselves get into a situation where we define a schema field in 214 that is different than the corresponding field in 122. If this is the case then the 214 key should be new key, not a copy.

In addition to the check, this PR removes all the redundant definitions of 122 fields in 214 keys. Fortunately none of the re-definitions actually changed the value so we’re all good.

0 attachments

0 comments

Loading commits...