jmespath / jmespath/jmespath.site

Please help me decide about extending syntax for jmespath

Open
#70 1 comment 12 reactions 0 assignees View on GitHub
Dominant language
Makefile
Stars
61
Forks
61
PR merge metrics
No merged PRs in 30d

Description

I am in process of starting new project extending jmespath with more syntax. Currently now I work on basic jmespath and extend it to support math operation `+` `-` `*` `/` `%` with antlr. I got the antlr file from https://github.com/burtcorp/jmespath-java

I am now stuck on design decision and wish that you could kindly help me with some suggestion

- Should I support bitwise operation with `&&` `||` `^` ?
- Is it acceptable to use `&&` and `||` as bitwise operator?
- `1 || 2` will return `3` for instance
- And still wonder is it really necessary, especially xor operator `^`
- But if I include this `^` operator, it also support boolean `xor` in addition to `&&` and `||`

- Should I bring back root node `$` from jsonpath?

- Should I bring back `**` operator from jsonpath?

- Should I support ternary `condition ? true : false` operator ?

- Should I support `??` and `?!` operator ?
- And remove support on `&&` `||` for null check in the same manner of js
- It might be used as bitwise operator above instead
- One difference is it will not treat `false` as `null`. Only `null` and empty
- I would like to add support to backtracing to parent node with `@..` syntax
- `nth number of dots - 1` will backtrack to nth parent
- `$.me.obj..` is equal to `$.me`
- `$.me.obj...` is equal to `$`
- Is there any better syntax for this ?

- I would like to add support to index value with `#` symbol
- For array, `#` would be index number `0,1,2,...`
- For object, `#` would be string `"{key}"`
- What should I do for deep reference ?
- `#` for current level, `##` for previous level ?
- `$.me.obj[0].#` return `0`
- `$.me.obj[0].##` return `"obj"`
- `$.me.obj[0].###` return `"me"`
- `#` for current level, `..#` for previous level ?
- `$.me.obj[0].#` return `0`
- `$.me.obj[0]..#` return `"obj"`
- `$.me.obj[0]...#` return `"me"`
- `#` for current level, `##` will be fullpath as array?
- `$.me.obj[0].#` return `0`
- `$.me.obj[0].##` return `["me","obj",0]`
- What should I do for slice and query? `#` will be index of sliced iteration or actual index?

- I would like to support object projection key by expression #64

- Any other idea overall? Any other things you don't satisfied with jmespath?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.