Skip to content

Instantly share code, notes, and snippets.

@glyn
Last active November 19, 2020 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glyn/cfc750d65ee32f5354013cea9ce7475e to your computer and use it in GitHub Desktop.
Save glyn/cfc750d65ee32f5354013cea9ce7475e to your computer and use it in GitHub Desktop.
JSONPath comparisons for unions with duplication
echo '["a"]' | ./src/wrap_in_docker.sh ./src/one_off.sh '$[0,0]'
Sending build context to Docker daemon 75.26kB
Step 1/24 : FROM ubuntu:20.10
...
Step 24/24 : RUN apt-get install -y --no-install-recommends ruby
---> Using cache
---> 25adaf4f6bcb
Successfully built 25adaf4f6bcb
Successfully tagged json-path-comparison:latest
[1/4] (cd implementations/Bash_JSONPath.sh && npm install) && echo > implementations/Bash_JSONPath.sh/build/node_modules_installed
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN Bash_JSONPath.sh@1.0.0 No description
npm WARN Bash_JSONPath.sh@1.0.0 No repository field.
audited 1 package in 0.535s
found 0 vulnerabilities
[2/4] LANG=en_US.UTF-8 LC_ALL= LC_COLLATE=C bash -c "diff --ignore-space-change <(echo 42) <(implementations/Bash_JSONPath.sh/run.sh ''\\$''[1]'' <<< '[0, 42]' | tr -d ' \n') || diff --ignore-space-change <(echo '[42]') <(implementations/Bash_JSONPath.sh/run.sh ''\\$''[1]'' <<< '[0, 42]' | tr -d ' \n')" > build/test_compilation/Bash_JSONPath.sh
[3/4] (cd implementations/PHP_softcreatr-jsonpath && composer update) && echo > implementations/PHP_softcreatr-jsonpath/build/composer_installed
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
1 package you are using is looking for funding.
Use the `composer fund` command to find out more!
[4/4] LANG=en_US.UTF-8 LC_ALL= LC_COLLATE=C bash -c "diff --ignore-space-change <(echo 42) <(implementations/PHP_softcreatr-jsonpath/run.sh ''\\$''[1]'' <<< '[0, 42]' | tr -d ' \n') || diff --ignore-space-change <(echo '[42]') <(implementations/PHP_softcreatr-jsonpath/run.sh ''\\$''[1]'' <<< '[0, 42]' | tr -d ' \n')" > build/test_compilation/PHP_softcreatr-jsonpath
./implementations/Bash_JSONPath.sh
OK
["a"]
./implementations/C_json-glib
OK
["a", "a"]
./implementations/Clojure_json-path
OK
"a"
./implementations/Cpp_jsoncons
OK
["a"]
./implementations/Elixir_ExJsonPath
OK
["a", "a"]
./implementations/Elixir_jaxon
OK
[]
./implementations/Elixir_warpath
OK
["a", "a"]
./implementations/Erlang_ejsonpath
OK
["a", "a"]
./implementations/Golang_github.com-PaesslerAG-jsonpath
OK
["a", "a"]
./implementations/Golang_github.com-bhmj-jsonslice
OK
["a"]
./implementations/Golang_github.com-oliveagle-jsonpath
OK
["a", "a"]
./implementations/Golang_github.com-spyzhov-ajson
OK
["a", "a"]
./implementations/Golang_github.com-vmware-labs-yaml-jsonpath
OK
["a", "a"]
./implementations/Haskell_jsonpath
OK
["a", "a"]
./implementations/JavaScript_Goessner
OK
["a", "a"]
./implementations/JavaScript_brunerd
OK
["a", "a"]
./implementations/JavaScript_jsonpath
OK
["a"]
./implementations/JavaScript_jsonpath-plus
OK
["a", "a"]
./implementations/Java_com.github.jsurfer
OK
["a"]
./implementations/Java_com.jayway.jsonpath
OK
["a", "a"]
./implementations/Kotlin_com.nfeld.jsonpathkt
OK
["a", "a"]
./implementations/Objective-C_SMJJSONPath
OK
["a", "a"]
./implementations/PHP_Goessner
OK
["a", "a"]
./implementations/PHP_galbar-jsonpath
OK
["a", "a"]
./implementations/PHP_remorhaz-jsonpath
OK
["a"]
./implementations/PHP_softcreatr-jsonpath
OK
["a", "a"]
./implementations/Perl_JSON-Path
OK
["a", "a"]
./implementations/Python_jsonpath
OK
["a", "a"]
./implementations/Python_jsonpath-rw
NOT_SUPPORTED
Exception('Parse error at 1:3 near token , (,)')
./implementations/Python_jsonpath2
OK
["a", "a"]
./implementations/Raku_JSON-Path
OK
["a", "a"]
./implementations/Ruby_jsonpath
OK
["a", "a"]
./implementations/Rust_jsonpath
NOT_SUPPORTED
parsing error
./implementations/Rust_jsonpath_lib
OK
["a", "a"]
./implementations/Scala_jsonpath
OK
["a", "a"]
./implementations/dotNET_Json.NET
OK
["a", "a"]
./implementations/dotNET_JsonPath.Net
ERROR
'a' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 1.
./implementations/dotNET_JsonPathLib
OK
["a", "a"]
./implementations/dotNET_Manatee.Json
OK
["a"]
echo '{"a":1}' | ./src/wrap_in_docker.sh ./src/one_off.sh '$['a','a']'
Sending build context to Docker daemon 75.26kB
Step 1/24 : FROM ubuntu:20.10
...
Step 24/24 : RUN apt-get install -y --no-install-recommends ruby
---> Using cache
---> 25adaf4f6bcb
Successfully built 25adaf4f6bcb
Successfully tagged json-path-comparison:latest
[1/4] (cd implementations/Bash_JSONPath.sh && npm install) && echo > implementations/Bash_JSONPath.sh/build/node_modules_installed
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN Bash_JSONPath.sh@1.0.0 No description
npm WARN Bash_JSONPath.sh@1.0.0 No repository field.
audited 1 package in 1.023s
found 0 vulnerabilities
[2/4] LANG=en_US.UTF-8 LC_ALL= LC_COLLATE=C bash -c "diff --ignore-space-change <(echo 42) <(implementations/Bash_JSONPath.sh/run.sh ''\\$''[1]'' <<< '[0, 42]' | tr -d ' \n') || diff --ignore-space-change <(echo '[42]') <(implementations/Bash_JSONPath.sh/run.sh ''\\$''[1]'' <<< '[0, 42]' | tr -d ' \n')" > build/test_compilation/Bash_JSONPath.sh
[3/4] (cd implementations/PHP_softcreatr-jsonpath && composer update) && echo > implementations/PHP_softcreatr-jsonpath/build/composer_installed
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
1 package you are using is looking for funding.
Use the `composer fund` command to find out more!
[4/4] LANG=en_US.UTF-8 LC_ALL= LC_COLLATE=C bash -c "diff --ignore-space-change <(echo 42) <(implementations/PHP_softcreatr-jsonpath/run.sh ''\\$''[1]'' <<< '[0, 42]' | tr -d ' \n') || diff --ignore-space-change <(echo '[42]') <(implementations/PHP_softcreatr-jsonpath/run.sh ''\\$''[1]'' <<< '[0, 42]' | tr -d ' \n')" > build/test_compilation/PHP_softcreatr-jsonpath
./implementations/Bash_JSONPath.sh
OK
{"a": 1}
./implementations/C_json-glib
NOT_SUPPORTED
Unable to compile selector `$[a,a]': Invalid array index definition “a,a]”
./implementations/Clojure_json-path
ERROR
java.lang.Exception object must be an array.
./implementations/Cpp_jsoncons
OK
[1]
./implementations/Elixir_ExJsonPath
NOT_SUPPORTED
syntax error before: <<"a">>
./implementations/Elixir_jaxon
OK
[]
./implementations/Elixir_warpath
NOT_SUPPORTED
Parser error: Invalid token on line 1, syntax error before: <<"a">>
./implementations/Erlang_ejsonpath
NOT_SUPPORTED
syntax error before: <<"a">>
./implementations/Golang_github.com-PaesslerAG-jsonpath
OK
[]
./implementations/Golang_github.com-bhmj-jsonslice
OK
[1]
./implementations/Golang_github.com-oliveagle-jsonpath
ERROR
strconv.Atoi: parsing "a": invalid syntax
./implementations/Golang_github.com-spyzhov-ajson
OK
[1, 1]
./implementations/Golang_github.com-vmware-labs-yaml-jsonpath
NOT_SUPPORTED
invalid array index [a,a] before position 6: error in union member 0: non-integer array index
./implementations/Haskell_jsonpath
NOT_SUPPORTED
Invalid JSONPath: $[a,a]
Error: searchBeginningWithSlice: string
./implementations/JavaScript_Goessner
OK
[1, 1]
./implementations/JavaScript_brunerd
ERROR
Malformed path expression : $[a,a]
./implementations/JavaScript_jsonpath
NOT_SUPPORTED
Parse error on line 1:
$[a,a]
--^
Expecting 'STAR', 'SCRIPT_EXPRESSION', 'INTEGER', 'ARRAY_SLICE', 'FILTER_EXPRESSION', 'QQ_STRING', 'Q_STRING', got 'IDENTIFIER'
./implementations/JavaScript_jsonpath-plus
OK
[1, 1]
./implementations/Java_com.github.jsurfer
NOT_SUPPORTED
line 1:2 no viable alternative at input '[a'
org.antlr.v4.runtime.misc.ParseCancellationException
./implementations/Java_com.jayway.jsonpath
NOT_SUPPORTED
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
com.jayway.jsonpath.InvalidPathException: Could not parse token starting at position 1. Expected ?, ', 0-9, *
./implementations/Kotlin_com.nfeld.jsonpathkt
NOT_SUPPORTED
Unexpected char, char=a, index=2
./implementations/Objective-C_SMJJSONPath
NOT_SUPPORTED
Could not parse token starting at position 1 . Expected ?, ', 0-9, *
./implementations/PHP_Goessner
OK
[1, 1]
./implementations/PHP_galbar-jsonpath
OK
[1, 1]
./implementations/PHP_remorhaz-jsonpath
OK
[1]
./implementations/PHP_softcreatr-jsonpath
NOT_SUPPORTED
Error: 'Unable to parse token a,a in expression: [a,a]'
./implementations/Perl_JSON-Path
OK
[1, 1]
./implementations/Python_jsonpath
OK
[1, 1]
./implementations/Python_jsonpath-rw
OK
[1, 1]
./implementations/Python_jsonpath2
NOT_SUPPORTED
line 1:3 mismatched input ',' expecting '('
ValueError("line 1:3 mismatched input ',' expecting '('")
./implementations/Raku_JSON-Path
NOT_SUPPORTED
JSON path parse error at position 1
./implementations/Ruby_jsonpath
ERROR
invalid value for Integer(): "a"
./implementations/Rust_jsonpath
NOT_SUPPORTED
parsing error
./implementations/Rust_jsonpath_lib
NOT_SUPPORTED
path error:
$[a,a]
^^
./implementations/Scala_jsonpath
NOT_SUPPORTED
JPError(end of input expected)
./implementations/dotNET_Json.NET
NOT_SUPPORTED
Unexpected character while parsing path indexer: a
./implementations/dotNET_JsonPath.Net
NOT_SUPPORTED
Could not identify selector
./implementations/dotNET_JsonPathLib
OK
[1, 1]
./implementations/dotNET_Manatee.Json
NOT_SUPPORTED
Unrecognized JSON Path element. Path up to error: '$'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment