Current logic flow insrc/handlers/mapping_handler.cpp: the incoming request path has concrete indices extracted and replaced with generic symbols (#) as one of the first steps in MappingHandler::map. Later, the generate_map_path helper function tries to match this (modified) exact string first before attempting other patterns using the find_mapping helper. find_mapping would then attempt to match with the actual index number if a generic case is not found first.
The motivating example is where for a given IDS path you want to express a generic pattern for the majority of index numbers (a general case) but where there are particular exceptions to that rule (alternate mappings for individually specified index numbers). I think this would typically be the expected behaviour (e.g. template specialisation in c++, specific overrides general).
e.g. for coils, where the solenoid is a special case, often treated very differently from other PF coils.
"some/mapping/path[#]/data" : {
"data_source": "MDSPLUS"
"args": {
"signal": < some generic pattern >,
... },
"slice": {{ index.0 }}
},
"some/mapping/path[5]/data" : {
"data_source": "MDSPLUS"
"args": {
"signal": < some very specific alternate TDI logic >,
... },
},
The current behaviour means the general case always overrides a specific case, but I'd expect the opposite to be true.
Is there an explicit rationale for the current behaviour or can I change it?
Current logic flow in
src/handlers/mapping_handler.cpp: the incoming request path has concrete indices extracted and replaced with generic symbols (#) as one of the first steps inMappingHandler::map. Later, thegenerate_map_pathhelper function tries to match this (modified) exact string first before attempting other patterns using thefind_mappinghelper. find_mapping would then attempt to match with the actual index number if a generic case is not found first.The motivating example is where for a given IDS path you want to express a generic pattern for the majority of index numbers (a general case) but where there are particular exceptions to that rule (alternate mappings for individually specified index numbers). I think this would typically be the expected behaviour (e.g. template specialisation in c++, specific overrides general).
e.g. for coils, where the solenoid is a special case, often treated very differently from other PF coils.
The current behaviour means the general case always overrides a specific case, but I'd expect the opposite to be true.
Is there an explicit rationale for the current behaviour or can I change it?