Postman GraphQL schema validation

I’m new to GraphQl (tester not a dev) and was wondering if there was anywhere that explained how to do schema validation in Postman for GraphQL? Possibly with an example schema etc?

I think, this is the better place to look for schema validation. Below is the link, but it is not specific to graphql

Hello @w4dd325,

GraphQL schema validation can be found in API builder and adding to @ansarise, you can find some good GraphQL examples here: Postman

Best,
Vikram Sahu.

1 Like

Sorry if this is a stupid question…

But if I take the SpaceX example from the above link, and copy in the API with schema etc. When I add it into the POST API call like in the picture below (bit in blue / dropdown box); it doesn’t appear to do anything? … I edited the “mission_name” to be Int not String to force a fail, but it doesn’t appear to show anything that suggests the response is wrong. Am I looking at this wrong? Should it express that a value is incorrect?

Hello @w4dd325 ,
For Postman GraphQL schema validation you have to go to the APIs tab in Postman and Click on the New API, set API name and make sure you’re in the Define tab.
Now, select GraphQL as your spec from the dropdown menu and add your schema then you can save it.
Head back over to the Collections tab, attach your schema by selecting it from the drop-down menu.

2 Likes

Hi @jalbert48 thank you for your reply.

I tried this in the post above, here is the view of the API tab (this is an example taken from the link provided above ^^ );

And as you can see in the screenshot in my post above the schema is selected in the collection request dropdown (in blue) …

However… if I purposely break the schema, it doesn’t tell me that the response is wrong anywhere??

I was working with a dev yesterday and we came to the conclusion that the “definition” is just to allow auto-complete while building your API’s… I could be wrong but I can’t see validation anywhere