Replies: 1 comment
-
No, Jackson explicitly stays out of content validation business: expectation is that validation is done separately using something like Bean Validation API or such. Hence there are no validation annotations, nor plans to add any (or support). You could/need to add validation logic in your POJOs, and/or use validation frameworks. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
suppose i have following pojo that i do (de)serialization operations with
and it maps to following json structure
is it possible to define at deserialization level that I expected
N
elements at most for propertybar
when deserializing given structure as object of type
Foo
? Expectation is something similar tothat of XML schemas, where schema defines how many times a given tag can appear ala
in this example i configured the element bar to appear 5 times using
maxOccurs
attribute, but given that json schemasaren't that widely adopted i'm looking for equivalent way to pass information via the parser
expectation is to prevent accidental ddos by passing oversized collections and tricking the application into doing a lot
of busy work for no reason.
i do see there is
StreamReadConstraints
in jackson-core which limits the json document size to 20mb by default which isgreat, and the respective request which requested to increase default to 1gb in jackson-core#1082 (why??)
i looked through annotations in jackson-core, and jackson-annotation but none of them seem to suffice. closest seems to be
@JsonFilter
, but it seems to only prevent serialization of given fieldBeta Was this translation helpful? Give feedback.
All reactions