-
Notifications
You must be signed in to change notification settings - Fork 856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New JSON Validator Needed #3199
Comments
Hi - thanks for being so receptive about looking into this. Being unable to perform JSON response validation is a big 'hole' for us right now. I'd like my team to focus on Postman for our testing, but we'll need to look for alternates for the JSON response validation soon. Could you share your timeline for adding functional JSON validation? Thanks! |
Hey! Our public roadmap is available here: https://trello.com/b/4N7PnHAz/postman-roadmap-for-developers so you can watch that. |
Thanks for this pointer; I'll follow this from now on. So, it appears that addressing JSON validation is not even a planning-level card, so this issue won't be addressed in the foreseeable future; is that correct? Thanks. |
Indeed, but since this is a new issue, we'll look into this in detail and update the roadmap accordingly :) |
Ah. thanks. |
To motivate an upvoting I would suggest that having a full CI and CD environment in which you generate Postman collections you definitely want to validate it against its own schema. |
I would like to motivate upvoting of this feature, but don't know how to accomplish what jvkaam suggested. That said, is this feature being considered for a future release? Thanks! |
Any update on this? |
Thinking of adding Ajv -> https://www.npmjs.com/package/ajv - does that sound good? |
We've added |
Did anyone use ajv successfully on postman native app v6.7.1? ( on MacOS )
Is there somebody met the same issue or I require ajv in the wrong way? |
@king4sam You can refer the example given here. You either have to use Example: var Ajv = require('ajv'),
ajv = new Ajv({logger: console}),
schema = {
"properties": {
"alpha": {
"type": "boolean"
}
}
};
pm.test('Schema is valid', function() {
pm.expect(ajv.validate(schema, {alpha: true})).to.be.true;
pm.expect(ajv.validate(schema, {alpha: 123})).to.be.false;
}); This is because |
@codenirvana thank you! |
Ajv assumes console to be present in the environment. It is an acceptable for all normal use cases. But we use AJV within Node VM module and that is sandboxed to not have console. The following line https://github.com/epoberezkin/ajv/blob/master/lib/ajv.js#L488 assumes console to be present. This results in issues such as [postmanlabs/postman-app-support#3199](postmanlabs/postman-app-support#3199) and requires to have a longer boilerplate code.
Since it doesn't appear that
tv4
is being actively maintained I think this issue needs to stop being punted down the road. Not only istv4
not maintained, but neither is it standard compliant with theJSON Schema
standards.As you can see there hasn't been any work done of on the source code for 2 years - https://github.com/geraintluff/tv4.
If you look at the issues you can see that they are not responded to by the original author:
https://github.com/geraintluff/tv4/issues
I think Postman owes it to its users to investigate and use a standards compliant library that is actively maintained.
A wrapper around the new library can be used so that the old
tv4
API can still work properly while still displaying the new API of whatever library Postman chooses to use.Here are previous issues on the subject:
Open
#2788
Closed
#3173
#3138
#2574
Thanks in advance!
The text was updated successfully, but these errors were encountered: