You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem
I read tv4 is deprecated in favor of Ajv [1][2], however the way you access Ajv is different than how you access tv4. With Ajv you have to require the package and new up a new instance, whereas with tv4 it is available as a shared instance across collection/folder pre-request scripts as well as the requests tests.
I find the shared instance particularly valuable when using the Runner/Newman to fetch/load the schema one time inside the collection pre-request script and use it over and over again across all my requests/tests, which is much faster than fetching the schemas over and over again inside each request's tests. Here's an example of how I'm able to have schemas only loaded once via the collection pre-request script:
The shared instance concept is something that we deprecated since it was getting in the way of visibility and conflicts with other scripts. It was also causing debugging issues. Having said that, the I understand the pain of logger issue and we are working to wrap AJV constructor to pre-inject console.
Additionally, two scripts in sandbox are isolated from each other, hence even though the older module variable (_, etc) appears global, but they are separate instances. Hence, this would be tricky. For now, it seems that adding schema in top level scripts and pass the instance to other scripts, is the only viable features.
Yes. Exactly. That’s the problem. The way we can achieve that is break script execution isolation while running scripts from collection level and then figure out a way to pass functions using “some method”. Both needs to be built. I’m just throwing ideas and possibilities. What comes out finally would be what fits best and adds most value. So, more feedback here would be great.
Describe the problem
I read tv4 is deprecated in favor of Ajv [1][2], however the way you access Ajv is different than how you access tv4. With Ajv you have to require the package and new up a new instance, whereas with tv4 it is available as a shared instance across collection/folder pre-request scripts as well as the requests tests.
I find the shared instance particularly valuable when using the Runner/Newman to fetch/load the schema one time inside the collection pre-request script and use it over and over again across all my requests/tests, which is much faster than fetching the schemas over and over again inside each request's tests. Here's an example of how I'm able to have schemas only loaded once via the collection pre-request script:
Describe the solution you'd like
Please add a shared instance of ajv to be used between requests.
Additional benefits:
{logger: console}
in the constructor and wondering why Ajv doesn't work for them. ReferenceError | console is not defined when using console.log #6400The text was updated successfully, but these errors were encountered: