Add custom error msgs for query validation failures #538
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #535
Adds custom user-friendlier error messages for missing top-level query keys (exclusively for now to get a sense of the contours of the general solution here). I also implemented custom messages for extraneous top-level query keys, which required setting the query map schema as "closed." But that seemed like what we probably wanted anyway?
I also cleaned up the query schema in a couple ways:
:map
schema itself points map keys at whichever value schema you want, and they are perfectly happy to reuse a value schema with a different name.::analytical-query
schema to just::query
and deleted the old::query
schema b/c it was trying to validate either a single or a multi-query. Those have their own API fns / entrypoints so we didn't actually need to validate either kind of query in a single context. Doing so was polluting the error messages with lots of extra, useless information when it tried to validate invalid single queries as multi-queries as a fallback.My goals with the error messages were:
/errorcodes
landing page which these messages link to. They are preliminarily on board with this based on this Slack conversation. We will need to coordinate adding the referenced error codes before merging this PR and in future PRs, as well as adding error code links to other existing error messages.We should open additional issues to address other categories of errors in a similar fashion.