Skip to content

Commit

Permalink
restrcutured logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kofoworola committed Jun 20, 2023
1 parent 6093c54 commit aa571ed
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/engine/datasource/rest_datasource/rest_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,10 @@ Next:
typeRef := p.v.Operation.VariableDefinitions[variableDefRef].Type
typeName := p.v.Operation.TypeNameString(typeRef)
typeKind := p.v.Operation.Types[typeRef].TypeKind
query[i].rawMessage = []byte(`"` + query[i].Value + `"`)
// if the type is not a nullable or non-nullable string, leave the rawMessage with quotes
if typeKind == ast.TypeKindList ||
(typeName != "" && typeName != typeString) ||
(typeKind == ast.TypeKindNonNull && p.v.Operation.TypeNameString(p.v.Operation.Types[typeRef].OfType) != typeString) {
// if type is a nullable or non nullable string, add quotes to the raw messasge
if typeName == typeString || (typeKind == ast.TypeKindNonNull && p.v.Operation.TypeNameString(p.v.Operation.Types[typeRef].OfType) == typeString) {
query[i].rawMessage = []byte(`"` + query[i].Value + `"`)
} else {
query[i].rawMessage = []byte(query[i].Value)
}

Expand Down

0 comments on commit aa571ed

Please sign in to comment.