I have a suite of microservices. Each service is a collection. My APIs share some core (JSON) objects. I’d like to define the schema for those shared objects once and re-use it across all my tests:
pm.test('response has correct schema', function () {
const {data} = pm.response.json();
if (!tv4.validate(data, pm.globals.get('shared_object_schema')
)) {
console.error(tv4.error);
pm.expect.fail()
}
});
(Actually I’d like to reuse the tests across the collections as well, but that’s another issue.)
Where is the best place to define pm.globals.set('shared_object_schema', ...)
so that it’s available in every endpoint across my entire workspace?