Archived topic — some details may be out of date.
Mock servers built from saved collection examples are still supported. Postman now also has code-based mocks: JavaScript request handlers plus aconfig.yaml, stored as files in your Git repository, which you can run locally or deploy. Create one in the app, or use the Postman CLI to generate one from an OpenAPI spec, collection or dataset (postman mock generate) and run it (postman mock run). See About mocks and Create a mock.
Working with an AI coding agent? The Postman plugin can build and run mocks for you.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.
Hi there, is it possible to create validations in requestBody so that 200 response is not always a response.
I have created a schema, collection and now a mock server, i get a 200 response, but the issue is that I have made certain requestBody fields as required fields in my schema, but when I send a request without these fields I still get a 200 response, when i want a 400, is there a way to create this kind of validation?
I thought if i have required: true in the requestBode then it would follow suite in the mock server.