Skip to content

Commit 3c3701d

Browse files
authored
feat: implement a language agnostic JSON test suite (#6)
1 parent 342778f commit 3c3701d

18 files changed

+2296
-1332
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Try it out on the online playground: <https://jsonquerylang.org>
1010

1111
## Features
1212

13-
- Small: just `2.9 kB` when minified and gzipped! The JSON query engine without parse/stringify is only `1.3 kB`.
13+
- Small: just `3.0 kB` when minified and gzipped! The JSON query engine without parse/stringify is only `1.4 kB`.
1414
- Feature rich (40+ powerful functions)
1515
- Easy to interoperate with thanks to the intermediate JSON format.
1616
- Expressive
@@ -34,6 +34,7 @@ On this page:
3434
External pages:
3535

3636
- [Function reference](reference/functions.md)
37+
- [Test Suite](test-suite/README.md)
3738

3839
## Installation
3940

@@ -623,7 +624,9 @@ Another gotcha is that unlike some other query languages, you need to use the `m
623624

624625
## Development
625626

626-
To develop, check out the repo, install dependencies once, and then use the following scripts:
627+
### JavaScript
628+
629+
To develop, check out the JavaScript repo, install dependencies once, and then use the following scripts:
627630

628631
```text
629632
npm run test
@@ -637,6 +640,12 @@ npm run build-and-test
637640

638641
Note that a new package is published on [npm](https://www.npmjs.com/package/@jsonquerylang/jsonquery) and [GitHub](https://github.com/jsonquerylang/jsonquery/releases) on changes pushed to the `main` branch. This is done using [`semantic-release`](https://github.com/semantic-release/semantic-release), and we do not use the `version` number in the `package.json` file. A changelog can be found by looking at the [releases on GitHub](https://github.com/jsonquerylang/jsonquery/releases).
639642

643+
### Implement in a new language
644+
645+
Support for JSON Query language can be implemented in new programming languages. Implementing the query engine is most straight forward: this boils down to implementing each of the functions (`sort`, `filter`, `groupBy`, etc.), and creating a compiler which can go through a JSON Query like `["sort", ["get", "name"], "desc"]` look up the function `sort`, and pass the arguments to it. Implementing a parser and stringifier is a bit more work, but the parser and stringifier of the JavaScript implementation can be used as a reference.
646+
647+
There is a JSON based Test Suite available that can be used to ensure that your implementation matches the behavior of the reference implementation, see: [Test Suite](test-suite/README.md).
648+
640649
## Motivation
641650

642651
There are many powerful query languages out there, so why the need to develop `jsonquery`? There are a couple of reasons for this.

package-lock.json

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"devDependencies": {
5656
"@biomejs/biome": "1.9.3",
5757
"@vitest/coverage-v8": "2.1.2",
58+
"ajv": "8.17.1",
5859
"npm-run-all": "4.1.5",
5960
"semantic-release": "24.1.2",
6061
"typescript": "5.6.3",

0 commit comments

Comments
 (0)