@@DenisKisina I would see it as an error and the json parser so per default too. You can configure it to ignore unknown fields. With jackson it is an annotation on top of the class. But I think the right thing to do was to reject the json at communicate with the call about why they add the extra fields?. You are specifying your api and should accept garbage data.
I think it is possible... I don't remember though... I think I would create the data with a Spring Boot unittest that generates the json... Maybe with Faker.
Hi mike, can you check why im being presented an error ( .detected is a required property, . Repeat_incident is a required property) for this required properties. It is working as intended though "required": [ "detected", "repeat_incident" ], "dependencies": { "detected": { "oneOf": [ { "properties": { "detected": { "type": "string", "enum": [ "other" ] } }, "required": [ "detected_explanation" ] },
hi Mike, Thanks for the great article. i need to validate a json against 'json schema" using java code. would you be able to share something helpful? thanks a ton in advance.
@@MikesTechCorner Thanks for the suggestion. I followed this and this is working fine. Also in the example it says Schema schema = SchemaLoader.load(jsonSchema); schema.validate(jsonSubject); So if the schema validation fails it will give exception/error but in case of success it is not returning anything so "Is there a way to tell if the schema validation is successfully done"? I don't want to use System.out.println("Schema validation successfully done"); 🙂🙂
Hi Mike Thanks for the video Can you please let us know how to validate a date using json schemas. For ex: if I want my date to be greater/lesser than a particular date. I am using ajv and there formatMinimum/formatMaximum are available but they seem to validate everything
years later and this tutorial is STILL amazing, thanks!
Thank you very much :)
very well explanatory video, even without understanding almost anything in English, I managed to do it on the first attempt
I am happy to hear that.
@@MikesTechCorner I started a project and it already has more than 3k in lines xd
Thank you, this has been really helpful. Brilliant.
Great to hear!
Thanks for your video, it's very helpful.
You are welcome! Thx for commenting. :)
@@MikesTechCorner Just one question though, how would you detail with fields that are not in jsonschema or misspelled but not required?
@@DenisKisina I would see it as an error and the json parser so per default too. You can configure it to ignore unknown fields. With jackson it is an annotation on top of the class. But I think the right thing to do was to reject the json at communicate with the call about why they add the extra fields?. You are specifying your api and should accept garbage data.
@@MikesTechCorner I agree with your suggestion of handling and communicating the culprit fields.
great tutorial! this was very helpful
I'm happy to hear that:)
awsome tutorial. helped me a lot.
Like you can create XML API samples from XML Schema can we create JSON API requests from JSON Schema?
I think it is possible... I don't remember though... I think I would create the data with a Spring Boot unittest that generates the json... Maybe with Faker.
@@MikesTechCorner Thanks Mike, would love to see a sample or some resources that cover this topic if you know / come across ..🙏
the procedure is the same in pycharm which made it much easier
Thank you for the tip.
So nicely explained
Thank you very much 🙂
lifesaver!,.. :) Thank you.
Glad it helped!
Thank you so much , great explanation
Thanks for watching :)
Thank you Mike.
You are welcome. :-)
Hi mike, can you check why im being presented an error ( .detected is a required property, . Repeat_incident is a required property) for this required properties. It is working as intended though
"required": [
"detected",
"repeat_incident"
],
"dependencies": {
"detected": {
"oneOf": [
{
"properties": {
"detected": {
"type": "string",
"enum": [
"other"
]
}
},
"required": [
"detected_explanation"
]
},
"detected" is mentioned in the beginning as required. But try to change the schema and check the result.
Very nice video. Thanks!
Thank you for watching. :-)
hi Mike,
Thanks for the great article.
i need to validate a json against 'json schema" using java code. would you be able to share something helpful?
thanks a ton in advance.
Try this article: www.baeldung.com/introduction-to-json-schema-in-java
@@MikesTechCorner Thanks for the suggestion. I followed this and this is working fine.
Also in the example it says
Schema schema = SchemaLoader.load(jsonSchema);
schema.validate(jsonSubject);
So if the schema validation fails it will give exception/error but in case of success it is not returning anything so "Is there a way to tell if the schema validation is successfully done"?
I don't want to use
System.out.println("Schema validation successfully done");
🙂🙂
Can we add dependencies for the checkboxes ?
Hmmm I don't understand? The JSON Schema is just a file
God video, Mike!
Thank you Søren :)
very well explained...thanks!
Glad it was helpful! Thank you for watching
Hi, can you please explain how to implement Json Schema validation for multi module projects. I am currently using spring boot and Swagger.
Thats a great idea! Yes I have added it to my to do list
@@MikesTechCorner Thank you so much
can i add http method in the schema ?
No because it is a description of the data format... not a specification of protocol
awesome. Thank you
You are welcome. Try my website for data conversion
Hi Mike
Thanks for the video
Can you please let us know how to validate a date using json schemas. For ex: if I want my date to be greater/lesser than a particular date.
I am using ajv and there formatMinimum/formatMaximum are available but they seem to validate everything
I don't think you can do that. You have to check that in your program.
Bear cute
lol
Jumped to 13:00
Check
it is bit hard to follow your english pronunciation.
I am sorry. I will try to improve. Join my discord server. links are in the latest videos. :-) Thx for watching.