Adding custom formats

116 views
Skip to first unread message

James Cook

unread,
Dec 12, 2014, 3:21:43 PM12/12/14
to json-schem...@googlegroups.com
I am attempting to use the library to validate the new XAPI spec recently released. This specification contains a separate file for formats that are custom to the schema.


Is this code the correct approach for adding custom formats? 

I am basically building my own ValidationConfiguration, by extending the default library with a series of CustomFormatAttribute instances.

I cannot test any further yet, because I am getting other errors that I will inquire about next, once I am sure this code is valid.



James Cook

unread,
Dec 14, 2014, 1:06:16 PM12/14/14
to json-schem...@googlegroups.com

Francis Galiegue

unread,
Dec 14, 2014, 1:18:06 PM12/14/14
to James Cook, json-schem...@googlegroups.com
Hello,

On Sun, Dec 14, 2014 at 7:06 PM, James Cook <jc...@transcordia.com> wrote:
> Also, here is the gist for the CustomFormatAttribute.
>

Well, the code looks fine to me.

Looking at your schema however, I see that it uses the deprecated, non
JSON Pointer fragments; why not use "definitions" and JSON Pointers
instead?

--
Francis Galiegue, fgal...@gmail.com, https://github.com/fge
JSON Schema in Java: http://json-schema-validator.herokuapp.com
Parsers in pure Java: https://github.com/parboiled1/grappa (redde
Caesaris: https://github.com/sirthias)

James Cook

unread,
Dec 15, 2014, 9:08:57 AM12/15/14
to json-schem...@googlegroups.com, jc...@transcordia.com
Thanks. I don't own the schema, but I will put together a pull request for the change to #/definitions. They maintain the schema as a series of individual fragments, and I think they were selecting a method that would work with a directory of fragments, and one large consolidated schema. I'm not sure if #/definitions would work in that case.


According to this document, they should probably adopt an absolute JSON pointer approach, but I think no matter which approach they use, they will have to do some text replacement when they combine their JSON fragments into a single document.

Is that typical?

-- jim
Reply all
Reply to author
Forward
0 new messages