Introduction
This tool validates GraphQL queries against a schema defined using Schema Definition Language (SDL) so that callers know they need to update their GraphQL queries and their GraphQL responders to match the current schema.You can use GraphQL Query Validators as standalone tools to manually validate GraphQL queries or connect it to tools that send or receive messages in GraphQL format to verify that the queries are valid. See Validating Incoming Requests for an example of using validators like this one in a common workflow.
Attaching a GraphQL Query Validator to Existing Tools
You can attach a GraphQL Query Validator tool to test clients, PVA responders, or other tools that exchange data in GraphQL format.
- Right-click on a tool and choose Add Output...
Select the traffic option you want to validate and choose GraphQL Query Validator then click Finish.
- Enter the URL or location of the SDL in the GraphQL SDL location field. You can also click Browse to navigate to an SDL file.
- You can also reference an environment variable using the
${variable-name}syntax if it's defined in the suite. The resolved URL will be displayed when referencing the variable.
- You can also reference an environment variable using the
- Enable Persist as Relative Path if you want the path to this file to be saved as a path that is relative to the current configuration file.
When the client executes, an error will be reported if a query does not conform to the SDL.
Using a Standalone GraphQL Query Validator
- Right-click on a Test Suite and choose Add New > Test.
- Select the type of test you want to validate and choose GraphQL Query Validator then click Finish.
- Enter the URL or location of the SDL in the GraphQL SDL location field. You can also click Browse to navigate to an SDL file.
- You can also reference an environment variable using the
${variable-name}syntax if it's defined in the suite. The resolved URL will be displayed when referencing the variable.
- You can also reference an environment variable using the
- Enable Persist as Relative Path if you want the path to this file to be saved as a path that is relative to the current configuration file.
- Click the Input tab and either choose the Text or File option to specify the incoming payload.
- Save your changes.
When the client executes, an error will be reported if a query does not conform to the SDL.