JSON Schema and $ref

397 views
Skip to first unread message

John Tangney

unread,
Jul 24, 2014, 8:22:44 PM7/24/14
to jacks...@googlegroups.com
We have upgraded to 2.4.1 are using jackson-module-jsonSchema to generate JSON Schema. We see $ref being written like this "urn:jsonschema:com:example:control:json:Foo". How do we get the referenced classes (like Foo in this case) to be included in the schema? If I understand correctly, the schema for Foo should be included somewhere in the output, but it is not.

I am posting to the dev list because of a comment in the 'user' forum that this is a better place for Schema-related questions.

Thanks,
--johnt

Tatu Saloranta

unread,
Jul 29, 2014, 12:58:31 PM7/29/14
to jacks...@googlegroups.com
I don't know the answer off-hand, but Francis might know.

One problem (not the only, I know) with the module is that it supports next-to-latest revision of schema spec I think. It is also bit difficult to understand the control flow all around; however, having said that, a few developers have been able to figure out how to add new features so it should be possible to add missing things.

-+ Tatu +-



--
You received this message because you are subscribed to the Google Groups "jackson-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jackson-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Francis Galiegue

unread,
Oct 31, 2014, 9:33:10 AM10/31/14
to jacks...@googlegroups.com
On Tue, Jul 29, 2014 at 6:58 PM, Tatu Saloranta <tsalo...@gmail.com> wrote:
> I don't know the answer off-hand, but Francis might know.
>
> One problem (not the only, I know) with the module is that it supports
> next-to-latest revision of schema spec I think. It is also bit difficult to
> understand the control flow all around; however, having said that, a few
> developers have been able to figure out how to add new features so it should
> be possible to add missing things.
>

"$ref" is a JSON Reference, therefore a URI; an implementation of JSON
Schema will have to be able to handle these URIs.

As far as my implementation is concerned, I use the scheme as a
referrent; therefore, for such a URI as:

"urn:jsonschema:com:example:control:json:Foo"

I'd code a URIResolver for scheme "urn".

The spec only says that a JSON Reference must be a URI; it does not
specify _how_ those URIs are resolved, if at all. This is entirely
implementation dependent.

Regards,
--
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)
Reply all
Reply to author
Forward
0 new messages