Skip to content

Commit 3368ae1

Browse files
committed
fix(qido-rs): allow multiple tags for includefield query parameter
1 parent 6837f13 commit 3368ae1

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

src/api/qido/service.rs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,15 @@ impl<'a> Visitor<'a> for IncludeFieldVisitor {
180180
if v.to_lowercase() == "all" {
181181
Ok(IncludeField::All)
182182
} else {
183-
let entry = StandardDataDictionary
184-
.by_expr(v)
185-
.ok_or_else(|| E::custom(format!("unknown tag {v}")))?;
186-
Ok(IncludeField::List(vec![entry.tag()]))
183+
v.split(',')
184+
.map(|v| {
185+
let entry = StandardDataDictionary
186+
.by_expr(v)
187+
.ok_or_else(|| E::custom(format!("unknown tag {v}")))?;
188+
Ok(entry.tag())
189+
})
190+
.collect::<Result<Vec<_>, _>>()
191+
.map(IncludeField::List)
187192
}
188193
}
189194

@@ -298,6 +303,24 @@ mod tests {
298303
);
299304
}
300305

306+
#[test]
307+
fn parse_query_params_multiple_includefield() {
308+
let uri =
309+
Uri::from_static("http://test?offset=1&limit=42&includefield=PatientWeight,00100010");
310+
let Query(params) = Query::<QueryParameters>::try_from_uri(&uri).unwrap();
311+
312+
assert_eq!(
313+
params,
314+
QueryParameters {
315+
offset: 1,
316+
limit: 42,
317+
include_field: IncludeField::List(vec![tags::PATIENT_WEIGHT, tags::PATIENT_NAME]),
318+
match_criteria: MatchCriteria(vec![]),
319+
fuzzy_matching: false,
320+
}
321+
);
322+
}
323+
301324
#[test]
302325
fn parse_query_params_default() {
303326
let uri = Uri::from_static("http://test");

0 commit comments

Comments
 (0)