Virtualizing GraphQL

book

Article ID: 237645

calendar_today

Updated On:

Products

Service Virtualization

Issue/Introduction

Have a requirement to create a VS for a GraphQL request and response. Does DevTest support GraphQL virtualization?

 

Cause

No supported as of 10.7.x release.

Environment

Release : 10.7

Component : DevTest Virtual Service

Resolution

GraphQL virtualization is not supported by DevTest in the released versions but it is available to the Application Test from 10.7. The GraphQL functionality need to be enhanced to support virtualization. 

 

Additional Information

Workaround:

Giving GraphQL query in JSON format then it can works with JSON or REST DPH, means  need to make the request as JSON instead of GraphQL.

For example, application/json content type graphql request can be made with the below JSON format: 
{
"query": "query HeroNameAndFriends($episode: Episode) { hero(episode: $episode) { name friends { name } } }",
"variables": { "episode": "JEDI" },
"operationName": "HeroNameAndFriends"
} 

Changing GraphQL request to JSON then the calls can be virtualized. If support needed for for Content-Type:application/graphql then need to wait for GraphQL virtualization to be supported in DevTest.