Skip to content
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

Plugfest outcome: Xpath features useful for discovery #29

Open
mmccool opened this issue Jun 19, 2020 · 2 comments
Open

Plugfest outcome: Xpath features useful for discovery #29

mmccool opened this issue Jun 19, 2020 · 2 comments

Comments

@mmccool
Copy link
Contributor

mmccool commented Jun 19, 2020

JSONPath is simpler (and lacks a formal specification, and implementations vary...), but XPath is more full-featured and better specified. It turns out some of the XPath features are useful and important for directory search... and we can depend on them, since they are actually required by a specification.

@farshidtz
Copy link
Member

farshidtz commented Jun 19, 2020

Use case: Search for things which have HTTP endpoint

@k-toumura: nodegen only support HTTP and WebSocket, so I want to filter out TDs which doesn’t have HTTP or Websocket endpoint.

The utilized JSONPath library doesn't support recursive descent for filtering. This can still be done if the path is known, e.g.:
$[?(@.properties.brightness.forms[0].href=~/^http/)].

To filter with XPath based on href inside form objects anywhere in the TD (incl. root level, inside interaction affordances):
*[*//forms/*[starts-with(href, 'http')]]

@mmccool
Copy link
Contributor Author

mmccool commented Jun 19, 2020

So apparently the JSON Path syntax does support recursion, but not all implementations do.

@mmccool mmccool changed the title Plugfest outcome: Xpath features Plugfest outcome: Xpath features useful for discovery Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants