Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Fix for #39 (Nil union values not handled properly by jackson) #40

Merged
merged 2 commits into from
Dec 8, 2019

Conversation

Kaiser1989
Copy link

@Kaiser1989 Kaiser1989 commented Dec 6, 2019

Here is my Pull request for Ticket #39

Following things changed:

  • Changed complete behaviour of Jackson-Deserialization
    • Don't use deserialize to Map anymore, use JsonNode instead
    • Added deserialization strategy for every TypeDeclaration
    • Unions, Arrays and Any Types are not supported
    • Sorting of types for better deserialization (integer before number)
  • All Unions are working fine:
    • Objects, nil and primitive types
    • Inline declaration and type declaration
  • Throwing an Ambiguous Exception if ambiguous types are used
    • This needs to be done as two String types cannot be distinguished when in Json Format anymore
  • Changed ObjectCreation for Unions to create correct inline types
  • Changed structure of Unions:
    • Changed union name (string | integer | nil => StringIntegerNilUnion)
    • Instead of one "any-field" all types have their own field (anyfield was removed)
    • This is needed, as validation cannot be done on a single field (imagine a Email (string with pattern) and nil union)
    • Created enum of types in unions to allow Switch statements, not asking every field
  • Added field creation to JSR303 to add validation for union fields
  • Changed naming of union fields to match the given type (Email (type String)) is now used as Email and not as String anymore (isEmail, getEmail)
  • Moved implementation from jackson2 to jackson (without jackson2 stuff)
  • Added jackson2 test
  • Added validation test
  • Fixed some formatting in SpecMatchers

@jpbelang jpbelang merged commit baa75b8 into mulesoft-labs:release/1.0.7 Dec 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants