JsonSchemaGenerator to include min and max length of field in schema

577 views
Skip to first unread message

Naresh

unread,
Sep 19, 2017, 10:36:58 AM9/19/17
to jackson-user
Hi ,

I'm generating JSON Schema from POJO. Currently, i see schema is generated without max and min length for String type. Is there any way to get length in generated JSON schema?

-Naresh Kumar

Morten Kjetland

unread,
Sep 20, 2017, 2:58:21 PM9/20/17
to jackso...@googlegroups.com

Hi,

You can give https://github.com/mbknor/mbknor-jackson-jsonSchema a try.

-Morten


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

Tatu Saloranta

unread,
Sep 25, 2017, 3:27:52 PM9/25/17
to jackson-user
+1 for trying that generator -- question of what to do with the
current generator (module under FasterXML) is still open with respect
to Jackson 3.
There are enough problems (f.ex only supporting schema spec v3; lack
of active maintainer) that I am contemplating deprecating it, as there
are better external packages available.

As to the original question: these lengths would need to be obtained
from somewhere, since Jackson itself does not handle validation.
I thing Bean Validation API has annotations but I don't know what
would be involved with piping, and how easy it would be to wire them
in,
if no support exists (I remember there being some support, just not
very extensive).
I would be open to PRs

-+ Tatu +-

ps. As always, make sure to run an up-to-date version -- 2.8.10 or
2.9.1 -- to see what does work already
Reply all
Reply to author
Forward
0 new messages