File tree 3 files changed +25
-9
lines changed
3 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ func New() *Executor {
18
18
19
19
// ExecuteResult is the result of the execute method.
20
20
type ExecuteResult struct {
21
- Result string
21
+ // ImplementationIntrospection is the introspection result of a graphql implementation.
22
+ ImplementationIntrospection types.ImplementationIntrospection
22
23
}
23
24
24
25
// ExecuteParams is the params of the execute method.
25
26
type ExecuteParams struct {
27
+ // Implementation is the implementation parameter.
26
28
Implementation types.Implementation
27
29
}
28
30
@@ -32,12 +34,12 @@ func (e *Executor) Execute(params ExecuteParams) (*ExecuteResult, error) {
32
34
Query : params .Implementation .Introspection .Query ,
33
35
}
34
36
35
- result , err := e .goExecutor .Run (runParams )
37
+ runResult , err := e .goExecutor .Run (runParams )
36
38
if err != nil {
37
39
return nil , err
38
40
}
39
41
40
42
return & ExecuteResult {
41
- Result : result . Result ,
43
+ ImplementationIntrospection : runResult . ImplementationIntrospection ,
42
44
}, nil
43
45
}
Original file line number Diff line number Diff line change 5
5
"fmt"
6
6
7
7
"github.com/graphql-go/graphql"
8
+
9
+ "graphql-go/compatibility-standard-definitions/types"
8
10
)
9
11
10
12
// Go handles the go execution of a introspection query.
@@ -46,7 +48,8 @@ type RunParams struct {
46
48
47
49
// RunResult represents the result of the run method.
48
50
type RunResult struct {
49
- Result string
51
+ // ImplementationIntrospection is the result of an introspection of a graphql implementation.
52
+ ImplementationIntrospection types.ImplementationIntrospection
50
53
}
51
54
52
55
// Run runs and returns a given introspection query.
@@ -77,12 +80,22 @@ func (g *Go) Run(params *RunParams) (*RunResult, error) {
77
80
return nil , joinedErrs
78
81
}
79
82
80
- result , err := json .Marshal (doResult )
83
+ doResultData , err := json .Marshal (doResult . Data )
81
84
if err != nil {
82
85
return nil , fmt .Errorf ("failed to do marshal: %w" , err )
83
86
}
84
87
88
+ introspectionResult := & types.IntrospectionQueryResult {}
89
+
90
+ if err := json .Unmarshal ([]byte (doResultData ), introspectionResult ); err != nil {
91
+ return nil , err
92
+ }
93
+
94
+ implementationIntrospection := types.ImplementationIntrospection {
95
+ QueryResult : * introspectionResult ,
96
+ }
97
+
85
98
return & RunResult {
86
- Result : string ( result ) ,
99
+ ImplementationIntrospection : implementationIntrospection ,
87
100
}, nil
88
101
}
Original file line number Diff line number Diff line change @@ -115,13 +115,14 @@ func (e *Extractor) extractImplementation(implementation types.Implementation) (
115
115
Query : string (introspectionQuery ),
116
116
}
117
117
118
- if _ , err := e .executor .Execute (executor.ExecuteParams {
118
+ executeResult , err := e .executor .Execute (executor.ExecuteParams {
119
119
Implementation : implementation ,
120
- }); err != nil {
120
+ })
121
+ if err != nil {
121
122
return nil , fmt .Errorf ("failed to execute: %w" , err )
122
123
}
123
124
124
- return & types .ImplementationIntrospection {} , nil
125
+ return & executeResult .ImplementationIntrospection , nil
125
126
}
126
127
127
128
// parseSpec parses and returns the introspection result of the graphql specification
You can’t perform that action at this time.
0 commit comments