graphql-client
graphql-client copied to clipboard
Parse Issue causes queries/mutations to ignore Argument on InputObject
Gem Versions ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18] graphql (1.9.2) graphql-client (0.14.0) rspec (3.2.0) rspec-core (3.2.3)
The Error I Receive:
/Users/mac.mccarthy/Automation/lib/broadcasts/broadcast.rb:37: Argument 'name' on InputObject 'BroadcastCreateInput' is required. Expected type String! (GraphQL::Client::ValidationError)
Mac-McCarthy:qa-proj mac.mccarthy$
This is my code:
Create720p60 = API::Client.parse <<-'GRAPHQL'
mutation(
$namespaceId: ID!,
$name: String!,
$inputType: ENUM_BROADCASTINPUT,
$videoInput: Int,
$videoFrameWidthMax: Int,
$videoFrameHeightMax: Int,
$videoFrameRateMax: Int,
$videoKeyFrameIntervalMilliseconds: Int
)
{
createBroadcast(
namespaceId: $namespaceId,
input: {
name: $name,
input: {
inputType: $inputType,
videoInput: $videoInput,
videoFrameWidthMax: $videoFrameWidthMax,
videoFrameHeightMax: $videoFrameHeightMax,
videoFrameRateMax: $videoFrameRateMax,
videoKeyFrameIntervalMilliseconds: $videoKeyFrameIntervalMilliseconds
}
})
{
id
name
status
broadcastEncoders {
id
}
}
}
GRAPHQL
The error happens when I run rspec, calling the mutation above. The error is on that first level of input, where I have name: $name,. The JSON formatting above works in graphiql, but never seems to work when running in ruby-rspec. If I remove the name: $name, I get the same error as when that required line is in place.
Let me know if you need more information.