Skip to content

Commit

Permalink
Test for variable in nested json (#2374)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie authored Feb 19, 2025
2 parents d0b27f8 + 651cfd6 commit 3ca9661
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
jsonIdentity: {
someValue: {
ohnoavariable: 42,
},
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
classDef path fill:#eee,stroke:#000,color:#000
classDef plan fill:#fff,stroke-width:1px,color:#000
classDef itemplan fill:#fff,stroke-width:2px,color:#000
classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left


%% plan dependencies
PgSelect9[["PgSelect[9∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
Object12{{"Object[12∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
__InputDynamicScalar6{{"__InputDynamicScalar[6∈0] ➊"}}:::plan
Object12 & __InputDynamicScalar6 --> PgSelect9
Access10{{"Access[10∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
Access11{{"Access[11∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
Access10 & Access11 --> Object12
Access7{{"Access[7∈0] ➊<br />ᐸ0.valueᐳ"}}:::plan
Access7 --> __InputDynamicScalar6
__Value0["__Value[0∈0] ➊<br />ᐸvariableValuesᐳ"]:::plan
__Value0 --> Access7
__Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
__Value2 --> Access10
__Value2 --> Access11
First13{{"First[13∈0] ➊"}}:::plan
PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
PgSelectRows14 --> First13
PgSelect9 --> PgSelectRows14
PgSelectSingle15{{"PgSelectSingle[15∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
First13 --> PgSelectSingle15
PgClassExpression16{{"PgClassExpression[16∈0] ➊<br />ᐸ__json_identity__.vᐳ"}}:::plan
PgSelectSingle15 --> PgClassExpression16
__Value4["__Value[4∈0] ➊<br />ᐸrootValueᐳ"]:::plan

%% define steps

subgraph "Buckets for queries/v4/json-nested-query"
Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 7, 10, 11, 6, 12<br />2: PgSelect[9]<br />3: PgSelectRows[14]<br />ᐳ: 13, 15, 16"):::bucket
classDef bucket0 stroke:#696969
class Bucket0,__Value0,__Value2,__Value4,__InputDynamicScalar6,Access7,PgSelect9,Access10,Access11,Object12,First13,PgSelectRows14,PgSelectSingle15,PgClassExpression16 bucket0
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select
__json_identity__.v::text as "0"
from "c"."json_identity"($1::"json") as __json_identity__(v);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## expect(errors).toBeFalsy();
#> schema: ["a", "b", "c"]
#> dynamicJson: true
#> variableValues: {"value": 42}
query Q($value: Int!) {
jsonIdentity(json: { someValue: { ohnoavariable: $value } })
}

0 comments on commit 3ca9661

Please sign in to comment.