Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions v2/pkg/engine/datasource/grpc_datasource/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,14 @@ func (p *RPCCompiler) Compile(executionPlan *RPCExecutionPlan, inputData gjson.R

for _, call := range executionPlan.Calls {
inputMessage := p.doc.MessageByName(call.Request.Name)
if inputMessage.Name == "" {
return nil, fmt.Errorf("input message %s not found in document", call.Request.Name)
}

outputMessage := p.doc.MessageByName(call.Response.Name)
if outputMessage.Name == "" {
return nil, fmt.Errorf("output message %s not found in document", call.Response.Name)
}

request := p.buildProtoMessage(inputMessage, &call.Request, inputData)
response := p.newEmptyMessage(outputMessage)
Expand Down
9 changes: 9 additions & 0 deletions v2/pkg/engine/datasource/grpc_datasource/execution_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ type RPCField struct {
Message *RPCMessage
}

// AliasOrPath returns the alias of the field if it exists, otherwise it returns the JSONPath.
func (r *RPCField) AliasOrPath() string {
if r.Alias != "" {
return r.Alias
}

return r.JSONPath
}

// RPCFields is a list of RPCFields that provides helper methods
// for working with collections of fields.
type RPCFields []RPCField
Expand Down
Loading
Loading