JSON Schema validation in Postman

  Рет қаралды 48,689

Valentin Despa

Valentin Despa

Күн бұрын

Пікірлер: 76
@vdespa
@vdespa 5 жыл бұрын
👉 Want to learn more about Postman? Check my Postman online course. www.udemy.com/course/postman-the-complete-guide/?referralCode=4E8B90BA4B5EE8DA9237
@stefanrhys1838
@stefanrhys1838 4 жыл бұрын
Hello Valentine, I do love watch your videos as it had helped a lot. And this video was much needed. But I have a issue, I noticed your only changing the body that is the response. What if and this does happen alot more then I would want. But if the type is changed. For example we know the type is object but let's say you have a property that is a type string that may change to a type number. The type has changed but not the body. How does ajv get around this. This maybe good for more advance topics of not changing the body of the response.
@vdespa
@vdespa 4 жыл бұрын
@@stefanrhys1838 See the next tutorial. It deals with more advanced use-cases.
@hiteshsivabhavirisetty1966
@hiteshsivabhavirisetty1966 3 жыл бұрын
After providing required, change the attribute name in the properties and send the request. postman will fail in that case. Example : in you schema, you have mentioned code in both "properties" and in "required". now, change the name "code" to "id(some other name)" postman cannot validate that. the test will be a pass
@daniellister4701
@daniellister4701 2 жыл бұрын
I'm about to start creating my first RESTful API, and I have to say that this video alone is going to allow me to focus more on writing the code than the documentation etc. Thank you, keep up the good work Valentin.
@vdespa
@vdespa 2 жыл бұрын
Glad it was helpful!
@Przemek_K_
@Przemek_K_ 2 жыл бұрын
I'm starting to use Postman at work and your tips are incredibly valuable. Thank You very much!
@vdespa
@vdespa 2 жыл бұрын
Great to hear! You are welcome. Thank you for leaving a comment.
@lucabamo
@lucabamo 3 жыл бұрын
The tutorial was very useful for me. I have not understood how schema validation works until I watch this video. Thank you, Valentin!
@vdespa
@vdespa 3 жыл бұрын
You are welcome!
@sipinthatbub
@sipinthatbub 3 жыл бұрын
Thanks a lot! I moved from not even knowing what a schema is to being able to build a basic one and test it.
@vdespa
@vdespa 3 жыл бұрын
Glad I could help!
@teleport96
@teleport96 5 жыл бұрын
You are just the greatest teacher! How do you find so simple words to explain complex things, I just don't get it... But thank you very much for your hard work! Bought your excellent Postman course on Udemy and several friends did the same after my advice. Again, thank you! Waiting for the new videos about JSON-Schema from you.
@vdespa
@vdespa 5 жыл бұрын
Thanks you so much for this amazing comment and your support. I really appreciate it.
@mireyca28
@mireyca28 4 жыл бұрын
This basic json schema validation help me a lot! Thank you very much Valentin!
@vdespa
@vdespa 4 жыл бұрын
Thanks for letting me know 👍
@rajatt95
@rajatt95 2 жыл бұрын
Thanks for creating these tutorials. Honestly, I've learned a lot from your UDEMY course and these tutorials.
@vdespa
@vdespa 2 жыл бұрын
You're very welcome! Thanks for watching my content and for taking the course.
@djmilen4o
@djmilen4o 4 жыл бұрын
Great video! Nice and clear! Straight to the point!
@vdespa
@vdespa 4 жыл бұрын
I am glad it helped! Thanks.
@rajiv0885
@rajiv0885 4 жыл бұрын
Thank you Valentin.. ! It was very helpful at right time of testing.
@vdespa
@vdespa 4 жыл бұрын
Great to hear that. Thanks!
@Kariemessi
@Kariemessi 10 ай бұрын
Hey Valentin, thanks for this video! I just finished your Udemy course but I struggle a bit to follow up with this one here, are there any video/documentation that I should be aware maybe before watching the Schema? Thanks a lot!
@gustavosouza3292
@gustavosouza3292 4 жыл бұрын
Extremely helpfull this video, I've looking for something to improve my tests in API beyond the status code, body and header....thanks a lot!
@vdespa
@vdespa 4 жыл бұрын
Glad it was helpful! Thanks for watching.
@sumitghewade2002
@sumitghewade2002 3 жыл бұрын
Hi Valentin Despa, Thank you for sharing such valuable educational videos. Could you please share the link where did you learn this from. Is there a need to create a mock server for the testing purposes?
@vdespa
@vdespa 2 жыл бұрын
Creating a mock server is useful. See json-schema.org/
@mylenna922
@mylenna922 5 жыл бұрын
Your videos are so useful! Thank you :)
@vdespa
@vdespa 5 жыл бұрын
Thank you for watching and for your comment. I appreciate it.
@danny_dainton
@danny_dainton 5 жыл бұрын
Awesome explanation!! 🏆
@vdespa
@vdespa 5 жыл бұрын
Thank you, Danny!
@on3p3301
@on3p3301 5 жыл бұрын
@@vdespa Thank you, Valentin! Really useful! :) Please make another video about other assertion cases ^_^
@vdespa
@vdespa 5 жыл бұрын
@@on3p3301 Thank you. Which assertions cases are you referring to?
@on3p3301
@on3p3301 5 жыл бұрын
@@vdespa I mean - are there any best practices in assertions with Schema Validation approach ? I mean cases with too much nesting in response. Also, how many types we can validate with S. validation approach - I mean - how to check "date", "array", "img" etc. ?
@vdespa
@vdespa 5 жыл бұрын
@@on3p3301 Great question. I will add some additional tutorials explaining how to do that, especially with nested objects, arrays and other types (date). If you have a concrete example response, send me an email at valentin@vdespa.com
@janithdesilva7518
@janithdesilva7518 Жыл бұрын
Hi there, How we can validate a json schema which is dynamically changing?
@nenadtrajanovski2824
@nenadtrajanovski2824 3 жыл бұрын
Hi Valentin. I still dont understand the point of why the test should NOT pass on the initial schema when we send {} - empty object??? its on 3:30 on the video. If i send an empty object to the simple schema that you wrote it will pass as well....
@vdespa
@vdespa 3 жыл бұрын
It depends if you expect it to pass or not. I guess the concept of required properties is something you need to be aware of.
@nenadtrajanovski2824
@nenadtrajanovski2824 3 жыл бұрын
@@vdespa But there is NOT any required property in the frist schema in your video, thats why I am confused between 3:27 and 3:40 you are saying: "The empty object is coming back but the schema is valid. So what is going on here? This person thought that this particular test and this particular schema will work just fine..." sorry for the big quotation.. So.. we don't have any required properties... why do we expect this test to fail when sending an empty object to this particular schema ?
@vdespa
@vdespa 3 жыл бұрын
@@nenadtrajanovski2824 some people don't think they need to add required properties and expect that this example will fail, if needed. Sorry for not being more explicit.
@nenadtrajanovski2824
@nenadtrajanovski2824 3 жыл бұрын
@@vdespa that explains, btw nice job on the udemy course, its a really good starting point in the API testing world, keep up the good work man!!!
@vdespa
@vdespa 3 жыл бұрын
@@nenadtrajanovski2824 Thanks, much appreciated!
@jayjaayjaaay94
@jayjaayjaaay94 4 жыл бұрын
what if "type": "string" but sometimes it can be null (nullable)
@vdespa
@vdespa 4 жыл бұрын
string and null are essentially two data types. Use can use "type": ["string", "null"]
@jayjaayjaaay94
@jayjaayjaaay94 4 жыл бұрын
@@vdespa i seee thank you!
@maorlv52
@maorlv52 Жыл бұрын
Thank you! that was very helpful ! :-)
@vdespa
@vdespa Жыл бұрын
Glad it was helpful! You are welcome. Thank you for leaving a comment.
@AndreaBoboOboe
@AndreaBoboOboe 5 жыл бұрын
Hi Valentin. Thank You very much for sharing all of this tips! I have a question : it's possible to retrive the schemas from external sources (for example from files or somewhere in the cloud) without write maybe long variables in the Postman code? Thank you!
@vdespa
@vdespa 5 жыл бұрын
Thank you for your comment, Andrea. Yes, this is possible. Here is a very simple example: pm.sendRequest("your.schema", function (err, response) { pm.test("Validate schema", () => { pm.response.to.have.jsonSchema(response.json()); }); });
@ivandurak387
@ivandurak387 4 жыл бұрын
@@vdespa Hi Valentin! Thanks for the lesson! I wonder if an external file can be entirely used for my body on sending a POST request for example? Thank you in advance!
@saimatabassum3660
@saimatabassum3660 3 жыл бұрын
@@vdespa what wlll be the url of schema , can you give some live example
@vdespa
@vdespa 3 жыл бұрын
@@saimatabassum3660 the URL will be the URL where the schema can be found. You need an external server to host this.
@VivienceHoang
@VivienceHoang 5 жыл бұрын
Thanks for sharing this tip!
@vdespa
@vdespa 4 жыл бұрын
You are welcome, thank you for your comment!
@satinderpal9393
@satinderpal9393 2 жыл бұрын
Hi, schema of my response body is dynamic i.e... Sometimes response body is {"address": xyz street, "zip code": 12345, "city": ABCD}. Sometimes it's {"address": xyz street, "zip code": 12345}. How can i code"required" in the Tests in such a scenario. Thanks
@vdespa
@vdespa 2 жыл бұрын
So you want to make city optional, right?
@satinderpal9393
@satinderpal9393 2 жыл бұрын
@@vdespa yes, "city" is not always present in response body
@vdespa
@vdespa 2 жыл бұрын
@@satinderpal9393 Have you tried not making it required?
@mustafwm
@mustafwm 4 жыл бұрын
starts at 3:30
@vdespa
@vdespa 4 жыл бұрын
Thank you for pointing this out. I think it is good to know also what not to do.
@jadedrakerider518
@jadedrakerider518 Жыл бұрын
What is the rationale of assuming every property is option unless specified otherwise? That seems designed to give false negatives.
@s1h2r345
@s1h2r345 2 жыл бұрын
How to validate request/response schema validation based on Swagger/Open API
@vdespa
@vdespa 2 жыл бұрын
AFAIK, there is not automated way to do this. You can use the API feature in Postman and link an API to a collection. You can the manually check if the collection follows the API spec.
@vijaykumar-ut1ze
@vijaykumar-ut1ze 4 жыл бұрын
How to check the schema of request body and also if that request body comes from a external data file?
@vdespa
@vdespa 4 жыл бұрын
Join the Facebook community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
@gsVerka
@gsVerka 4 жыл бұрын
@valentin Despa. I am finding your videos USEFUL. Thank you for sharing your knowledge with the world. One question: { "Value": ""} ---let's say this is the response body. What can I write in "properties": { "Value": {"type": ......What should be the type here?.....}}. I am expecting blank value. Thank you.
@vdespa
@vdespa 4 жыл бұрын
Thanks for your comment. This blank value is a string with a length 0.
@gsVerka
@gsVerka 4 жыл бұрын
{ "Value": {"type":"string", "minLength":0, "maxLength":0}}
@ferdzzzzzzzz
@ferdzzzzzzzz 4 жыл бұрын
Thanks man :D
@vdespa
@vdespa 4 жыл бұрын
You are welcome 😁
@gsVerka
@gsVerka 4 жыл бұрын
Question 2: {"Value": "Yes"} ---let's say this is the response body. I can write in "properties": {"Value": {"type":"string"} }. What if I want to check that the string is equal to "Yes" doing schema-validation-way. Thank you. I guess the ANSWER would be the use of enum as shown below: "properties":{"Value": {"enum": "Yes"}
@vdespa
@vdespa 4 жыл бұрын
It is hard to know what the problem is in this case. Join the Facebook community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
JSON Schema Validation in Python: Bring Structure Into JSON
13:45
Learn JavaScript for Postman API testing - Full Course for Beginners
1:28:39
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
An Introduction to JSON Schema: A Practical Look
35:46
Erik Wilde
Рет қаралды 13 М.
JSON Schema Validation: How to Validate JSON Schema with Postman?
11:50
The Testing Academy
Рет қаралды 104 М.
Consumer-driven Contract Testing using Postman
30:47
Valentin Despa
Рет қаралды 32 М.
Loop request based on data from response in Postman
13:13
Valentin Despa
Рет қаралды 62 М.
Валидация схемы JSON в Postman
21:00
Alex QA
Рет қаралды 3,4 М.
JSON Schema Validation in Rest Assured
12:38
Testers Talk
Рет қаралды 4,7 М.
Part 1 - JSON Schema For API Validation
39:23
Ganbaro Digital
Рет қаралды 20 М.
Mock Servers | The Exploratory
7:00
Postman
Рет қаралды 38 М.
Валидация JSON в Postman
29:35
Alexey Klimenko
Рет қаралды 4,2 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН