Open almson opened 4 years ago
Hey @almson, sorry to say that the property name comes from Jackson, and not from the code in this repo. The code implements JsonObjectFormatVisitor
to get hold of all the properties, as Jackson sees things, for a given type.
So I'm afraid what you're asking isn't possible. This question would need to be asked against the Jackson databind project.
Hmm, I'm not sure about the foo/boo name issue, but the assumption that the schema is for reading serialized objects (instead of writing json that will be deserialized) is pervasive in the code. For example, in these lines it is assumed that primitives are always required.
Thank you for creating this library!
It seems that the way this library works is that it generates a schema for serialization. Ie, it looks at @JsonValue instead of @JsonCreator. Is it possible to have it generate schemas for deserialization?
Here is an example:
It must be compiled with Java 8, javac option
-parameters
and following dependencies:The output is:
Note that the property is called "boo" instead of "foo", and it is marked as required.
Nevertheless, jsonSchema works pretty well as long as steps are taken to make the serialized output the same as the input. Annotations applied to parameters also work, probably due to how Jackson works.