# Where should I define global variables shared across collections?

**URL:** <https://community.postman.com/t/where-should-i-define-global-variables-shared-across-collections/38349>\
**Category:** Help Hub\
**Tags:** tests, variables, collections\
**Created:** [August 19, 2022, 2:23pm UTC](https://community.postman.com/t/where-should-i-define-global-variables-shared-across-collections/38349 "2022-08-19T14:23:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skux-life](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@skux-life](https://community.postman.com/u/skux-life)\
**Post date:** [August 19, 2022, 2:23pm UTC](https://community.postman.com/t/where-should-i-define-global-variables-shared-across-collections/38349/1 "2022-08-19T14:23:06Z")

</div>

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:

```auto
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?
