Skip to content

Commit ca226c4

Browse files
committed
Remove required fields for directory templates
When templates were going to be shared between instruments, it made sense to ensure that they included components that would differentiate them. Now that each instrument has its own template, this is no longer useful. The 'visit' component does not always make sense, eg for test environments where all data can be written to a central directory. The fields can still be used if required.
1 parent 9e65176 commit ca226c4

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

src/graphql/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,6 @@ mod input_template_tests {
12491249

12501250
#[rstest::rstest]
12511251
#[case::relative("tmp/{instrument}/{visit}")]
1252-
#[case::missing_instrument("/tmp/{visit}")]
1253-
#[case::missing_visit("/tmp/{instrument}/data")]
12541252
#[case::invalid_template("/tmp/{nested{placeholder}}")]
12551253
fn invalid_directory_template(#[case] path: String) {
12561254
InputTemplate::<DirectoryTemplate>::parse(Some(Value::String(path))).unwrap_err();

src/paths.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub struct DetectorTemplate;
139139
impl PathSpec for DirectoryTemplate {
140140
type Field = DirectoryField;
141141

142-
const REQUIRED: &'static [Self::Field] = &[DirectoryField::Instrument, DirectoryField::Visit];
142+
const REQUIRED: &'static [Self::Field] = &[];
143143

144144
const ABSOLUTE: bool = true;
145145
fn describe() -> &'static str {
@@ -221,8 +221,6 @@ mod paths_tests {
221221

222222
#[rstest::rstest]
223223
#[case::relative("relative/visit/path", InvalidPathTemplate::ShouldBeAbsolute)]
224-
#[case::missing_visit("/{instrument}/data", InvalidPathTemplate::MissingField("visit".into()))]
225-
#[case::missing_instrument("/data/{visit}", InvalidPathTemplate::MissingField("instrument".into()))]
226224
#[case::invalid_path_incomplete("/data/{unclosed", TemplateErrorType::Incomplete)]
227225
#[case::invalid_path_empty("/data/{}", TemplateErrorType::Empty)]
228226
#[case::invalid_path_nested("/data/{nes{ted}}", TemplateErrorType::Nested)]

0 commit comments

Comments
 (0)