-
Notifications
You must be signed in to change notification settings - Fork 139
Deserialize ArrayItems and JsonValueFormat correctly #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@Override | ||
public Items deserialize(JsonParser parser, | ||
DeserializationContext context) throws IOException, JsonProcessingException { | ||
ObjectCodec mapper = parser.getCodec(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume it is legal to use array, or a single item here?
This works, I can probably simplify it after merge a bit.
I think I'd like to know bit more about what exactly is being fixed and why. I can see that handling of If the change is needed, there are also ways to change definition of Handling of item array makes sense, but it would be good to have unit test(s) to show how things work better now. |
JsonValueFormat should be serializing and deserializing using the lower-snake-case values. These values are part of the JSON schema spec. If you run this example https://gist.github.com/georgewfraser/196c84c5072a800e9cb9 through a JSON schema validator, for example http://jsonschemalint.com/draft4/#, you will see that "date-time" is a real format that gets validated, but DATE_TIME is meaningless. I added some tests, and fixed some existing tests. |
And just to make sure, lower-snake-case is what JSON Schema v3 defines? (since that's what module supports). I know v4 has changed many things, and this has caused lots of confusion. |
Yes, all versions use lower-snake-case. |
Deserialize ArrayItems and JsonValueFormat correctly
Ok thanks. Just wanted to verify. |
Ok, merged, will do some minor cleanup. One thing I did not, wrt http://json-schema.org/latest/json-schema-validation.html#anchor104 that existing list does seem to fully align with that; and (for example), whereas we have "host-name", spec seems to have "hostname". Similarly with "ip-address" vs "ipv4". This could be some difference between v3 of json schema vs later verisons. I guess I won't be changing that quite yet, but thought I'd note it. |
What is your plan for moving to v4? I'm fixing some v3/v4 differences on https://github.com/fivetran/jackson-module-jsonSchema
|
… proper ser/deser for JsonValueFormat in databind, for 2.7
No solid plan. Some discussion on dev list (and with some developers). I think it is easiest to do via new module, instead of trying to add modality; similar to how Hibernate module (v3, v4, v5) works. It's probably best to discuss this further on |
No description provided.