Skip to content

docs(formatting): jep-001-nested-expressions, jep-003a-functions #181

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 68 additions & 87 deletions jep-001-nested-expressions.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Nested Expressions

|||
|---|---
| **JEP** | 1
| **Author** | Michael Dowling
| **Status** | accepted
| **Created**| 27-Nov-2013
| **JEP** | 1 |
| ----------- | --------------- |
| **Author** | Michael Dowling |
| **Status** | accepted |
| **Created** | 27-Nov-2013 |

## Abstract

Expand All @@ -27,16 +26,13 @@ provide customers with a much more flexible expression DSL.

Supporting arbitrarily nested expressions within other expressions requires:

- Updating the grammar to remove `non-branched-expr`

* Updating the grammar to remove `non-branched-expr`
- Updating compliance tests to add various permutations of the grammar to
ensure implementations are compliant.


* Updating compliance tests to add various permutations of the grammar to
ensure implementations are compliant.


* Updating the JMESPath documentation to reflect the ability to arbitrarily
nest expressions.
- Updating the JMESPath documentation to reflect the ability to arbitrarily
nest expressions.

## Nested Expression Examples

Expand All @@ -46,16 +42,17 @@ Given:

```json
{
"foo": {
"baz": [
{
"bar": "abc"
}, {
"bar": "def"
}
],
"qux": ["zero"]
}
"foo": {
"baz": [
{
"bar": "abc"
},
{
"bar": "def"
}
],
"qux": ["zero"]
}
}
```

Expand All @@ -64,13 +61,7 @@ With: `foo.[baz[*].bar, qux[0]]`
Result:

```json
[
[
"abc",
"def"
],
"zero"
]
[["abc", "def"], "zero"]
```

### Nested branch expressions with nested mutli-select
Expand All @@ -79,20 +70,21 @@ Given:

```json
{
"foo": {
"baz": [
{
"bar": "a",
"bam": "b",
"boo": "c"
}, {
"bar": "d",
"bam": "e",
"boo": "f"
}
],
"qux": ["zero"]
}
"foo": {
"baz": [
{
"bar": "a",
"bam": "b",
"boo": "c"
},
{
"bar": "d",
"bam": "e",
"boo": "f"
}
],
"qux": ["zero"]
}
}
```

Expand All @@ -102,17 +94,11 @@ Result:

```json
[
[
[
"a",
"c"
],
[
"d",
"f"
]
],
"zero"
[
["a", "c"],
["d", "f"]
],
"zero"
]
```

Expand All @@ -122,20 +108,21 @@ Given:

```json
{
"foo": {
"baz": [
{
"bar": "a",
"bam": "b",
"boo": "c"
}, {
"bar": "d",
"bam": "e",
"boo": "f"
}
],
"qux": ["zero"]
}
"foo": {
"baz": [
{
"bar": "a",
"bam": "b",
"boo": "c"
},
{
"bar": "d",
"bam": "e",
"boo": "f"
}
],
"qux": ["zero"]
}
}
```

Expand All @@ -144,13 +131,7 @@ With: `foo.[baz[*].not_there || baz[*].bar, qux[0]]`
Result:

```json
[
[
"a",
"d"
],
"zero"
]
[["a", "d"], "zero"]
```

### No breaking changes
Expand All @@ -162,12 +143,12 @@ Given:

```json
{
"foo": {
"baz": {
"abc": 123,
"bar": 456
}
"foo": {
"baz": {
"abc": 123,
"bar": 456
}
}
}
```

Expand All @@ -177,11 +158,11 @@ Result:

```json
[
{
"abc": 123,
"bar": 456
},
456
{
"abc": 123,
"bar": 456
},
456
]
```

Expand Down
Loading
Loading