-
Notifications
You must be signed in to change notification settings - Fork 12
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
change the way we report the location of errors #287
Comments
We can use Sample code to show this in our use-case:
Output:
Question 1: Is this format of path to the key acceptable? Or should we modify it to something like Furthermore,
rather we have something like this:
So, when we query for path to key like Question 2: It seemed to me that we might need to pass the reference to the whole config. But I am not sure, if it would be a good idea to pass the reference to the whole config all the way down, so we can trace the path to key? |
@nreinicke @robfitzgerald some inputs on this would be appreciated |
the string
you know @iantei, the custom JSON extensions you just refactored are actually fairly redundant to the built-in capabilities of serde_json and thiserror. if we were to start refactoring any further, i would want to talk about removing the |
This is the default way in which the node.location() is returned as string. It should not be difficult to transform into dot-delimited format.
I agree. If we refactor further, we would likely need not need functions like |
making JSONPath a first-class citizen in Compass was also referenced in #193. if you could loop that in with your work i would appreciate it. here's an example of how in a Compass configuration TOML file we can map fields in the Compass query response objects into CSV columns. this capability is implemented in pub enum CsvMapping {
Path(String),
Sum { sum: Vec<Box<CsvMapping>> },
Optional { optional: Box<CsvMapping> },
} from TOML, we can assign a mapping to CSV like this: [[response_output_policy.policies]]
type = "file"
filename = "output-summary.csv"
[response_output_policy.policies.format]
type = "csv"
sorted = true
[response_output_policy.policies.format.mapping]
error = { optional = "error" }
id = { optional = "request.origin_name" }
name = { optional = "request.name" }
dlon = "request.destination_x"
dlat = "request.destination_y"
olon = "request.origin_x"
olat = "request.origin_y"
model_name = "request.model_name"
distance = "route.traversal_summary.distance"
time = "route.traversal_summary.time"
energy_liquid = { optional = "route.traversal_summary.energy_liquid" }
energy_electric = { optional = "route.traversal_summary.energy_electric" }
distance_cost = "route.cost.distance"
time_cost = "route.cost.time"
energy_liquid_cost = { optional = "route.cost.energy_liquid" }
energy_electric_cost = { optional = "route.cost.energy_electric" }
total_cost = "route.cost.total_cost"
distance_unit = "route.state_model.distance.distance_unit"
time_unit = "route.state_model.time.time_unit"
energy_liquid_unit = { optional = "route.state_model.energy_liquid.energy_unit" }
energy_electric_unit = { optional = "route.state_model.energy_electric.energy_unit" }
distance_weight = "request.weights.distance"
time_weight = "request.weights.time"
energy_liquid_weight = { optional = "request.weights.energy_liquid" }
energy_electric_weight = { optional = "request.weights.energy_electric" }
search_result_size_mib = "search_result_size_mib" happy to jump on a call to talk it through! |
after discussion with @iantei we agreed that a more strategic refactor needs to happen to add JSONPaths to error messages, as components in Compass do not have access to the full configuration file at the call site for errors. |
I have created this new issue to discuss further on this change requirement:
#88 (comment)
Currently, when we report the location of errors, we pass the "parent_key" for reference. It's not quite descriptive enough to identify the error; just on the basis of "key" and "parent_key".
We want to pass JSONPath to the key instead of just a parent key
This would change the error format to -
expected value at foo.bar[3].baz to be bool, instead found '3.14159'
The text was updated successfully, but these errors were encountered: