Тёмный

JSON Schema validation in Postman 

Valentin Despa
Подписаться 60 тыс.
Просмотров 48 тыс.
50% 1

Опубликовано:

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 76   
@vdespa
@vdespa 4 года назад
👉 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!
@teleport96
@teleport96 4 года назад
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 4 года назад
Thanks you so much for this amazing comment and your support. I really appreciate it.
@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!
@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.
@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 👍
@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!
@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 2 года назад
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/
@Kariemessi
@Kariemessi 7 месяцев назад
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!
@jayjaayjaaay94
@jayjaayjaaay94 3 года назад
what if "type": "string" but sometimes it can be null (nullable)
@vdespa
@vdespa 3 года назад
string and null are essentially two data types. Use can use "type": ["string", "null"]
@jayjaayjaaay94
@jayjaayjaaay94 3 года назад
@@vdespa i seee thank you!
@gsVerka
@gsVerka 3 года назад
@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 3 года назад
Thanks for your comment. This blank value is a string with a length 0.
@gsVerka
@gsVerka 3 года назад
{ "Value": {"type":"string", "minLength":0, "maxLength":0}}
@mylenna922
@mylenna922 4 года назад
Your videos are so useful! Thank you :)
@vdespa
@vdespa 4 года назад
Thank you for watching and for your comment. I appreciate it.
@gsVerka
@gsVerka 3 года назад
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 3 года назад
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.
@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.
@danny_dainton
@danny_dainton 4 года назад
Awesome explanation!! 🏆
@vdespa
@vdespa 4 года назад
Thank you, Danny!
@on3p3301
@on3p3301 4 года назад
@@vdespa Thank you, Valentin! Really useful! :) Please make another video about other assertion cases ^_^
@vdespa
@vdespa 4 года назад
@@on3p3301 Thank you. Which assertions cases are you referring to?
@on3p3301
@on3p3301 4 года назад
@@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 4 года назад
@@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?
@VivienceHoang
@VivienceHoang 4 года назад
Thanks for sharing this tip!
@vdespa
@vdespa 4 года назад
You are welcome, thank you for your comment!
@AndreaBoboOboe
@AndreaBoboOboe 4 года назад
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 4 года назад
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 2 года назад
@@vdespa what wlll be the url of schema , can you give some live example
@vdespa
@vdespa 2 года назад
@@saimatabassum3660 the URL will be the URL where the schema can be found. You need an external server to host this.
@maorlv52
@maorlv52 Год назад
Thank you! that was very helpful ! :-)
@vdespa
@vdespa Год назад
Glad it was helpful! You are welcome. Thank you for leaving a comment.
@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.
@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?
@nenadtrajanovski2824
@nenadtrajanovski2824 2 года назад
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 2 года назад
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 2 года назад
@@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 2 года назад
@@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 2 года назад
@@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 2 года назад
@@nenadtrajanovski2824 Thanks, much appreciated!
@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.
@ferdinandsteenkamp1333
@ferdinandsteenkamp1333 4 года назад
Thanks man :D
@vdespa
@vdespa 4 года назад
You are welcome 😁
Далее
Consumer-driven Contract Testing using Postman
30:47
Просмотров 31 тыс.
Редакция. News: 137-я неделя
42:24
Просмотров 621 тыс.
LOLLIPOP-SCHUTZ-GADGET 🍭 DAS BRAUCHST DU!
00:28
Просмотров 12 млн
Advanced workflows (request chaining) with Postman
11:29
Data-driven testing using Postman
13:37
Просмотров 59 тыс.
How write API Tests with Postman in 3 easy steps
18:49
Просмотров 163 тыс.
Compare two JSON responses with Postman
30:14
Просмотров 22 тыс.
Loop request based on data from response in Postman
13:13
Introduction to the ChatGPT API with Postman
14:06
Просмотров 19 тыс.
Редакция. News: 137-я неделя
42:24
Просмотров 621 тыс.