0
votes

Hi I am learning JSON schema, I am having a doubt regarding format keyword by this http://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3 there are some predefined format types and we can also add some custom formats. My doubt is how to add those custom formats and validate it using any JSON schema validation tools

thanks Lakshmanan

1

1 Answers

0
votes

The way how custom formats are added to a schema validator is always implementation-specific. So if you use a PHP validator then you have to write a PHP class / function, if you use a java validator then you implement a java class. I can just hardly imagine any ways to write an implementation-independent custom validator. A schema validator may even decide not to support custom formats (although popular implementations do).

I personally don't recommend using custom formats. They are always implememtation-dependent, so if you want to consume your schema from different languages then most probably you have to write the format validator multiple times.