Ability to validate a jmespath expression against a JSON schema #71
sebastien-rosset
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem Statement
It does not seem possible to validate a JMES path expression against a JSON schema.
A user writes a JMES path expression and wants to determine if the expression is syntactically and semantically valid. The JMES parser can find syntax errors but not semantic errors. For example the user types the expression
foo[*].first
. This is syntactically a valid expression, but this may not be valid against a JSON schema, e.g., the JSON schema may not allow thefoo
property.If a JSON schema is available, it should be possible to determine whether a JMES expression refers to non-existent properties in the JSON schema. In the
foo[*].first
example, the validation would have to check if there is at least one match in the JSON schema.A related problem is to identify the set of schema elements that are referred by a jmespath expression.
I understand this is not trivial. For example, to evaluate a JMESpath expression such as
foo[100]
against a JSON schema, multiple scenarios need to be considered with a BFS traversal of the parsed expression.Beta Was this translation helpful? Give feedback.
All reactions