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

Examples that have no input #5629

Open
philrz opened this issue Feb 6, 2025 · 0 comments
Open

Examples that have no input #5629

philrz opened this issue Feb 6, 2025 · 0 comments

Comments

@philrz
Copy link
Contributor

philrz commented Feb 6, 2025

tl;dr

At the moment, it seems mdtest-spq can't support examples that have no input.

Details

Here's an example of where this would be useful:

```mdtest-command
super -z -c "SELECT VALUE 'hello, world'"
```
produces this Super JSON output
```mdtest-output
"hello, world"
```

Currently rendered as:

Image

When I was converting examples in #5489, in other cases where there was direct SELECT or yield of static values, I often morphed them into having explicit inputs, such as a null input that would work in this case, or a non-null value referenced as this in the query in other cases. However, this kind of direct SELECT/yield is indeed a convenience for the user so it seems like it would be nice to be able to show in the docs. Furthermore, this specific example seems like one where its original purpose was to show exactly that, so morphing it to have an echo'ed input seems like it would be inappropriate.

At the moment if I try to turn it into an mdtest-spq by just leaving the input portion blank, it doesn't render the result.

```mdtest-spq
# spq
SELECT VALUE 'hello, world'
# input
# expected output
"hello, world"
```

Image

Ideas

mdtest-spq already supports an empty output portion and this renders fine. See for instance:

```mdtest-spq
# spq
grep("10")
# input
{foo:10}
{bar:{s:"baz"}}
# expected output
```

Image

So maybe supporting empty input wouldn't be too hard?

If we come up with a way, it'd be ideal if the Playground rendering side can pick up on the empty input as a special case so that way when it creates the command line for the "CLI" tab it can leave out the leading echo .. | portion entirely.

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

1 participant