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

Well-Typedness of Function Expressions #54

Open
jg-rp opened this issue Dec 20, 2023 · 2 comments
Open

Well-Typedness of Function Expressions #54

jg-rp opened this issue Dec 20, 2023 · 2 comments

Comments

@jg-rp
Copy link
Contributor

jg-rp commented Dec 20, 2023

Using function extensions currently defined by the standard, it's not possible to test some valid JSONPath queries. Specifically, no standard function extension returns a NodesType result, and no standard function extension accepts a LogicalType parameter.

For example, if func() were a function extension defined to accept a LogicalType parameter and return a LogicalType result, the following queries would be valid.

The table in section 2.4.9 contains more combinations of parameter/result types that can't currently be tested.

The question is, should this test suite define non-standard function extensions in order to cover these cases?

If so, how could that be done? And should we attempt to maintain backwards compatibility for dependants that don't implement non-standard function extensions (that is, keep such test cases out of cts.json)?

See also the conversation on PR #51, which attempted to add a query similar to the first example above.

@glyn
Copy link
Contributor

glyn commented Dec 21, 2023

The question is, should this test suite define non-standard function extensions in order to cover these cases?

I don't think it should because presumably that would mean implementations would need to implement those non-standard extensions in order to pass the test suite.

I suppose one way round this would be to register standard function extensions for the purpose of testing.

@f3ath
Copy link
Collaborator

f3ath commented Dec 21, 2023

FWIW my implementation supports custom functions and provides a few non-standard ones as examples and for testing purposes, including

  • siblings() which is (NodesType) -> NodesType
  • xor() which is (LogicalType, LogicalType) -> LogicalType

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants