From the course: GraphQL for Enterprise Developers
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Setting up mocks with GraphOS - GraphQL Tutorial
From the course: GraphQL for Enterprise Developers
Setting up mocks with GraphOS
- [Instructor] Something that's important to know about updating the schema is anytime I add something to the schema, I need to have a matching resolver function in order for the schema to work. But let me show you a little workaround that we can do. So check this out, I'm going to add to our Cat, relationshipStatus. And then we'll add a string here. So over here on local host 4001, we can run our query. But if we try to run this with relationshipStatus, we'll notice that we can't return null for a non-nullable field Cat.relationshipStatus. So, this is kind of tricky because we want to be able to test out these queries as we're prototyping, as we're iterating, but we don't want these responses to come back as errors. Built into GraphOS Studio Explorer, there are some tools to help us with this. So, if you click on the little gear icon for Settings, you can click on Mock responses, and then this will mock everything. So this is going to, for IDs, return an ID, for strings, it'll always…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.