1

Problem Description: I have a file containing json schema. I want to use the schema to validate multiple collections in Postman. I want to be able to reference this file from a pre-request script or test-script.

What I've tried so far:

  • Globals/Data file: I have tried defining the schema as a globals file and importing that file at run-time. Using Newman command line, that involves modifying the run query. The test-automation criteria does not allow me to modify the run queries.
  • Separate collection: The schema could be separated into it's own collection and mentioned in a pre-request script to set global variable. The global variable can be used across all collections. The problem with this approach is a dummy request is needed to run the pre-request script.
  • File: Hence, I thought of putting schema in a file and see if there's a way to reference that from pre-request script.

Thanks!

babybear
  • 804
  • 1
  • 10
  • 24
  • I know this is ridiculously necro and you may not remember, but did you ever figure out a solution or workaround? – myahl May 21 '20 at 14:13
  • I ended up not using JSON schema since for my requirement digging deep into this was not worth it. But I just checked for any updates on Postman, and they've included the functionality to validate schema. https://learning.postman.com/docs/postman/design-and-develop-apis/the-api-workflow/#editing-your-schema Hope this helps! – babybear May 22 '20 at 18:05
  • Unfortunately my purpose is different, but thanks for the response. :) I was hoping you had figured out how to read in the file. – myahl May 27 '20 at 15:37

0 Answers0