-
-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for variable in nested json (#2374)
- Loading branch information
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
postgraphile/postgraphile/__tests__/queries/v4/json-nested-query.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
jsonIdentity: { | ||
someValue: { | ||
ohnoavariable: 42, | ||
}, | ||
}, | ||
} |
42 changes: 42 additions & 0 deletions
42
postgraphile/postgraphile/__tests__/queries/v4/json-nested-query.mermaid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
3 changes: 3 additions & 0 deletions
3
postgraphile/postgraphile/__tests__/queries/v4/json-nested-query.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
7 changes: 7 additions & 0 deletions
7
postgraphile/postgraphile/__tests__/queries/v4/json-nested-query.test.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } }) | ||
} |