Skip to content

Commit

Permalink
fix variables in GraphQL query documents imported from Insomnia and P…
Browse files Browse the repository at this point in the history
…ostman were not resolved
  • Loading branch information
sunny-chung committed Dec 4, 2023
1 parent 0187632 commit 8b18b74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,11 @@ class InsomniaV4Importer {
jsonParser.readValue<GraphqlRequestBody>(body)
.let {
GraphqlBody(
document = it.query,
document = it.query.convertVariables(postFlightBodyVariables),
variables = jsonParser.writerWithDefaultPrettyPrinter()
.writeValueAsString(it.variables)
.let { if (it == "null") "" else it },
.let { if (it == "null") "" else it }
.convertVariables(postFlightBodyVariables),
operationName = it.operationName,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ class PostmanV2ZipImporter {

"file" -> FileBody(file?.src)
"graphql" -> GraphqlBody(
document = graphql?.query ?: "",
variables = graphql?.variables ?: "",
document = graphql?.query?.convertVariables() ?: "",
variables = graphql?.variables?.convertVariables() ?: "",
operationName = null
)

Expand Down

0 comments on commit 8b18b74

Please sign in to comment.