Hello,
On Tue, Jun 11, 2013 at 8:35 PM, Aravind <
aravind...@gmail.com> wrote:
> Hi, Francis,
> I am using Jackson 1.9.6 and for Spring I am using 3.1.0-RELEASE
>
Uh. I don't know for Spring, but as far as Jackson is concerned, on a
computing scale history, 1.9.6 is somewhere between Renaissance and
the Secession war...
> <dependency>
> <groupId>org.codehaus.jackson</groupId>
> <artifactId>jackson-mapper-asl</artifactId>
> <version>1.9.6</version>
> </dependency>
>
Try and update to:
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.1</version>
as a dependency; do things still work for you?
Seriously. 1.9.x has been obsolete for a long time.
> To be honest, I haven't even tried the json-schema-validator library.
> I was googling for JSON Java validator and ran into the
> json-schema-validator github page.
>
> Before I wanted to give it a shot, I thought of asking this question first
> and you promptly responded.
>
OK, some background on what JSON Schema is.
JSON Schema is several things; one of its core component is JSON value
validation, for whatever value (any JSON primitive type, including
null; strings, numbers, booleans, arrays, objects). The
json-schema-validator library can validate any JSON value given a
valid schema. The json-schema-core library has two things:
* it embeds all things necessary for JSON Schema _syntax_ validation,
which is why json-schema-validator depends on it;
* it has a processor system which allows you to chain together
anything you can think of (for instance, json value --> validated json
value against a schema --> POJO).
> You mentioned that "Jackson has, very recently, added an option to its
> parser to reject
> duplicate keys; I am quite inclined to upgrade the library set
> requirement to at least a version with this option available".
>
Jackson's ability to barf on duplicate keys is quite recent; it is not
officially released yet...
> Do you know the version of Jackson that supports this feature?
See right above.
> I would like to try using the latest version of Jackson with the latest
> json-schema-validator sometime this week.
>
PLEASE NOTE: as stated in the README for both projects, when the
middle number is even, this is still a beta version; while it is
functional (I ensure it is so, I am not the kind to leeway on
testing), the API is not definitive yet; if you want a stable API, go
with 2.0.x of -validator (with 1.0.x of -core). I am a few weeks away
from making this 2.2.0/1.2.0, but not there yet...
> By the way, do you have any samples for integrating json-schema-validator
> with Spring and Jackson?
>
With Spring, I have nothing at the moment; but to be really honest, I
don't really know what you actually _expect_ to do with Spring ;) As
to Jackson, I use it daily, but maybe not the way you think (I mostly
use its tree model).
All in all, I am interested in your use case. Can you elaborate on
your usage scenario?
To conclude, I encourage you to have a look at the site in my
signature; see the "About this site" page. You'll find links to two
interesting projects there: JJSchema (generate a JSON Schema from a
POJO) and jsonschema2pojo (the reverse, as its name says).
I intend to plunge deeper into these projects when I get time; right
now however, I am side tracked by two other projects ;) Self
promotion:
https://github.com/fge/msg-simple
https://github.com/fge/uri-template
Have fun,